I have a list and I\'d like to set one item as class=\"active\" automatically. Given the following bootstrap code:
-
I solved a similar problem by creating a view for each item and using Here is the way it works for me: In tasklist.handlebars i iterate over my custom view Ember will insert a view (i. e. The view class for each item is defined in task_list_item_view.js as Finally the template for the view just renders my link in tasklistitem.handlebars AFAIK you have to specify the source data in the Hope that helpsclassNameBindings (I have to say that i don't have a HTML list, i.e.... in my app, just list of {{#each tasks}}
{{view App.TaskListItemView contentBinding="this"....}}
{{/each}}
App.TaskListItemView = Ember.View.extend({
controller: null,
classNameBindings: ['isSelected', 'isClosed'],
isClosed: function() {
var content = this.get('content');
return content && !content.isOpen(new Date);
}.property('controller.content.@each'),
isSelected: function() {
return (this.get('controller').isSelectedTask(this.get('content')));
}.property('controller.taskSelection.@each'),
....
});
....
property() call to let ember know when to (re-) evaluate the property.