jeudi 2 avril 2015

How can View properties be used in its template?


App.FolderListItemView = Ember.View.extend({
templateName: 'folder-list-item',
tagName: 'li',
classNames: ['folder'],
classNameBindings: ['opened'],
opened: false,
click: function (e) {
this.set('opened', !this.get('opened'));
}
});



<script type="text/x-handlebars" data-template-name="folder-list-item">
<i {{bind-attr class="opened:icon-content-plus:icon-content-minus"}}></i>
...
</script>


I would like to change the icon (plus/minus) according to the value of 'opened' of the view.


The bind-attr does not work. How should I deal with this?





Aucun commentaire:

Enregistrer un commentaire