From the course: Ember.js Essential Training
Unlock this course with a free trial
Join today to access over 22,400 courses taught by industry experts.
Template conditionals - Ember.js Tutorial
From the course: Ember.js Essential Training
Template conditionals
- [Instructor] Template conditionals are a way for us to ask a question in a template and make a decision to decide on what to display, depending upon the answer. We use helper in Ember to provide us with these conditionals. We have an if helper, an else helper, and an NLS helper. Let's build this to update our About page to only list public bookmarks. To begin, let's look at our route for the About page at app, routes, about.js. In our About page here, it's still using the code that grabs our collection of static bookmarks, so let's update this to access the store and grab our bookmarks, following the pattern that we've already seen. We'll replace online 24, the return bookmarks, with return this.get, the string store, to get our store, and then .FindAll, and then pass in the name of the model, in this case, bookmark. We can also now remove our bookmarks variable from Line 3 through 20. Now, let's update the about template at app, templates, about.hbs. Add after our each loop on Line…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.