http://jsfiddle.net/pauldechov/u4naE/
App.Router = Em.Router.extend({
enableLogging: true,
root: Em.Route.extend({
index: Em.Route.extend({
route: '/',
connectOutlets: function(router) {
router.get('applicationController').connectOutlet('application');
}
}),
// why does this work?
goHome: Em.Route.transitionTo('home'),
// ...but not this? Am I missing something?
goHome2: function(router, context) {
router.transitionTo('home', context);
},
home: Em.Route.extend({
route: 'home'
})
})
});
我收到一条错误消息:“您必须为事件 'goHome2' 指定目标状态,以便在当前状态 'root.index' 中链接到它。”
例如,如何在此处定义处理程序,以便可以返回 false 并停止传播?我真的应该在视图中执行此操作吗?该怎么做?
谢谢你。