私は次のような状態にあります
mysite.com/#/indexこれは初期化時にロードされるデフォルトのページです
他にもサブルートがありますmysite.com/#/aboutmysite.com/#/contact
誰かがmysite.com/#/aboutと入力した場合、サブステートのロードを制御できますか?
私は次のような状態にあります
mysite.com/#/indexこれは初期化時にロードされるデフォルトのページです
他にもサブルートがありますmysite.com/#/aboutmysite.com/#/contact
誰かがmysite.com/#/aboutと入力した場合、サブステートのロードを制御できますか?
ルーターでルート(URL)を定義している限り、Emberルーターはこれを自動的に実行します。
次のようなものは、URL mysite.com/#/aboutが入力されると、自動的に正しい状態に移動します。その状態が開始および終了したときに何が起こるかを制御する場合は、enter()およびexit()関数内でこれを指定します。
App.router = Ember.Router.create({
enableLogging: true,
//location: 'history',
root: Ember.Route.extend({
home: Ember.Route.extend({
route: '/',
redirectsTo: 'index'
}),
index: Ember.Route.extend({
route: '/index',
connectOutlets: function (router) {
router.get('applicationController').connectOutlet('index');
}
}),
about: Ember.Route.extend({
route: '/about',
enter: function() {
//stuff
}
exit: function() {
//stuff
}
connectOutlets: function (router) {
router.get('applicationController').connectOutlet('about',);
}
})
})
});