Iましサルパッチを当てたセッション変数に現在のルートコンポーネントを格納するために、私のルータ:エンバー2.5観察するセッションプロパティが変更さ
var Router = Ember.Router.extend({
customSession: Ember.inject.service('session-custom'),
location: config.locationType,
didTransition: function() {
this._super(...arguments);
this.get('customSession').set('currentEntity', this.get('currentRouteName').split('.')[0]);
this.get('customSession').set('currentDetailView', this.get('currentRouteName').split('.')[1]);
}
});
が、私はこれがソリューションのクリーンではないことを知っているが、セッションを書きます少なくともそれらのパラメータが設定されていることがコンソールに示されます。私のコントローラで
、私はこれらのパラメータの変化をリッスンしたいのですが、どういうわけか、これは動作しません。
import Ember from 'ember';
import ApplicationController from './application';
export default ApplicationController.extend({
customSession: Ember.inject.service('session-custom'),
currentRouteNameChanged: Ember.observer('customSession.currentEntity', function() {
console.log("route changed");
})
});
すなわち「ルートが変更され、」コンソールに出力されることはありません。
これはかなり簡単な修正と思われますが、私はSOの解決策を見つけることができませんでした。
ありがとうございます!