emberjs-1.0.0-rc-6.1
私のコントローラー:
Application.LoginController = Ember.Controller.extend({
loginFailed: false,
isProcessing: false,
isSlowConnection: false,
timeout: null,
login: function() {
/* some code */
},
success: function() {
this.reset();
},
failure: function() {
this.reset();
},
reset: function() {
clearTimeout(this.get("timeout"));
this.setProperties({
isProcessing: false,
isSlowConnection: false
});
}
});
私のルーティング:
Application.LoginRoute = Ember.Route.extend({
setupController: function(controller, model) {
controller.reset();
},
events: {
}
});
初めて「/login」に行くと、setupControllerが呼び出されます。ただし、アプリケーションがログインに遷移するたびに、イベント (遷移など) を使用して controller.reset() を呼び出したいと思います。
LOG_TRANSITIONS: true
コンソールに「Transitionned into 'login'」、「Transitionned into 'anotherPage'」が表示されるので、ルーターでこれらのログをトリガーするイベントを取得できるかどうかを知りたいです。
お気に入り :
Application.LoginRoute = Ember.Route.extend({
setupController: function(controller, model) {
controller.reset();
},
events: {
didTransition: function(reason) {
controller.reset();
}
}
});