前の回答は古くなっています。現在の Ember バージョン (1+) ではevents
非推奨であり、(関数ではなく)actions
オブジェクトを使用する必要があります。
残り火の例:
App.ApplicationRoute = Ember.Route.extend({
actions: {
error: function(err) {
// error handler called in case of an error.
// show the error message to user here
// or transition to another route
}
}
});
Ember CLI の例:
import Ember from 'ember';
export default Ember.Route.extend({
actions: {
error: function(err) {
// error handler called in case of an error.
// show the error message to user here
// or transition to another route
}
}
});
これらのアクション ハンドラーを使用すると、ルートでエラーを停止しなければ、エラーはメイン アプリケーション ルートに適切にバブリングされます。