javascript - Emberjs CollectionView action on item controller -
i having trouble firing actions each individual item controller items listed in collection view. far have created following
app.itemscontroller = ember.arraycontroller.extend({ itemcontroller: 'item', sortascending: true }); app.itemcontroller = ember.objectcontroller.extend({ isdrawvisible: false, actions: { toggledraw: function() { this.toggleproperty('isdrawvisible') } } }); app.itemsview = ember.collectionview.extend({ itemviewclass: app.itemview, contentbinding: 'controller', tagname: 'ul' }); app.itemview = ember.view.extend({ controllerbinding: 'content', templatename: 'item', tagname: 'li' });
and template file such
{{#with view.content}} <a class="btn btn-lg btn-drill left bottom" {{action 'toggledraw'}}>+</a> {{/with}}
in ember inspector each item in list has been given correct controller cannot seem fire off toggledraw
action on itemcontroller
update:
found out action being fired off there error in console stating nothing handled action whenever anchor element clicked. can explain this?
you need specify item controller in template, this:
{{#with view.content controller='item'}} <a class="btn btn-lg btn-drill left bottom" {{action 'toggledraw'}}>+</a> {{/with}}
see controller
option in with
helper docs here.
Comments
Post a Comment