I’ve got an arrayController that contains a list of recent search terms. When I push an item to the array it correctly displays the quantity of items on the view except for one problem…I can’t get the name to print.
Here’s the pertinent code
App.recentUsersArray = Em.ArrayController.create({
content: [],
addUser: function(name) {
this.pushObject(name);
}
});
<ol>
{{#each App.recentUsersArray}}
<li>
{{#view App.RecentNameView}} {{name}} {{/view}}
{{#view App.RecentNameDeleteView}}X{{/view}}
</li>
{{/each}}
</ol>
Inside this line: {{#view App.RecentNameView}} {{/view}} I’ve tried {{name}}. {{content.name}} but neither work. What am I doing wrong?
Try using “this”: http://jsfiddle.net/s7DbE/
Or this, which is answers the question a little better: http://jsfiddle.net/s7DbE/1/
Or this fiddle, which reverses the inputs: http://jsfiddle.net/s7DbE/2/