In Ember, if I use the Router, any {{action}}
helpers automatically target the view's controller, when the view was created by the router.
How can I make views' {{actions}}
target the controller when the Router doesn't create the view. I thought setting the controller
property would do it, but it doesn't appear to.
You would need to set a controller
property on the view pointing to your controller, and define a target
property on the controller like so:
App.MyController = Em.Controller.extend({
target: function(){
return this;
}.property()
...
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.