Sending an action to a view in Ember.js -
i have view contains close button:
.flash-message div class="close-button" click="view.removeflash" = view view.content.thisview
the view reads:
whistlr.alertview = ember.view.extend templatename: "_alert" removeflash: -> alert "close!"
however, when click on "close-button" div, nothing happens. i've tried rewriting button few different ways:
click="view.removeflash" click="removeflash" click="removeflash" target="view"
i've tried placing action directly in controller (though i'm not sure there controller view):
whistlr.alertcontroller = ember.objectcontroller.extend removeflash: -> alert "i work!"
none of these approaches work. perhaps it's not possible send action view controller? if not, how else can approach problem?
the syntax sending events views is, {{action myevent target="view"}}
. myevent
handler in corresponding view can handle event. without target event go controller in view's context.
i suspect happening emblem
putting target
attribute on element rather action handler. since target
valid attribute well. can confirm looking @ generated html in elements tab of dev tools.
unfortunately don't have workaround emblem. stuff works handlebars templates.
Comments
Post a Comment