May 2015
Beginner
220 pages
4h 16m
English
Again, we'll start by updating our templates. In the previous chapter, we created frontend/tpl/profile.html. It contains a form that we use for profile updates. Let's add the following code after it:
{{#if friends.length > 0}}
<div class="hero">
<h1>Friends</h1>
</div>
<div class="friends-list">
{{#each friends:index}}
<div class="friend-list-item">
<h2>{{friends[index].firstName}} {{friends[index].lastName}}</h2>
</div>
{{/each}}
</div>
{{/if}}If the Ractive component has a friends property, then we will render a list of users. The page will display the name of the users and it will look like the next screenshot:
The controller that renders the page should also be updated. We should use the same ...
Read now
Unlock full access