Rather than use an alert box to show the random number returning from the API call, Kyle demonstrates how to add a partial in the Grips template to display the result in HTML.
(techno oriental music)…- Let me just give you a slightly little bit more practice…by working with the template engine in the browser.…So, let's go to our...…about.grips file,…and let's define ourselves a little thing like...…Uh, let's see.…
Actually, let me do it this way.…Let's say that we want to include a partial.…Let's define that partial down here.…An example of shared form validation.…Let me see if I can come up with something.…That's a good suggestion.…
Let me see if I can come up with something…that won't be too complex.…Okay.…The defined partial here.…I'm sorry, we need to give it the I.D. answer.…Now, inside of here we want to have...…We'll make a div with a rel attribute of js-answer.…
And what we want to do is include inside of that div...…- [Student] Can you increase your font size a little?…- Yeah.…Is that better?…Okay.…Alright, so we want to include, so insert.…Now in grips, the way you get at your…local variable context that you can insert from.…You dollar sign dot and then I'll assume that…there's going to be something called answer there.…
Note: This course was created on 03/29/2016 by Frontend Masters. We are pleased to host this content in our library.
- Carousels, panes, and modules
- Middle-end architecture
- Secure phrase generator
- Routing functions
- Calling the API
- Rendering on the page
- Shared data validation
Skill Level Intermediate
2. Organizing Code
5. Adding a Shared Module
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.