[英]In Ember pre4's router, how do you trigger a route event from within another route?
I have code such as that shown below, and I'm just wondering how I can trigger another event within the route's events. 我有如下所示的代码,我只是想知道如何在路线事件中触发另一个事件。 Thoughts? 思考?
App.MyRoute = Ember.Route.extend({
events: {
eventOne: function() {
// do something
},
eventTwo: function() {
// how do I call eventOne() here?
},
}
});
You can just call events.eventOne()
using this
as the context: 你可以使用this
作为上下文调用events.eventOne()
:
App.IndexRoute = Ember.Route.extend({
events: {
eventOne: function() {
console.log('You got me!');
},
eventTwo: function() {
this.events.eventOne();
},
}
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.