0
在這個例子中無法獲取後退按鈕正常工作。始終返回到數據庫狀態。無法獲取後退按鈕正常工作在ember.js
App.Router = Ember.Router.extend({
enableLogging: true,
root: Ember.Route.extend({
index: Ember.Route.extend({
route: '/',
redirectsTo: 'databases'
})
}),
databases: Ember.Route.extend({
route: '/databases',
show: Ember.Route.transitionTo('database'),
connectOutlets: function(router) {
var applicationController = router.get('applicationController');
applicationController.connectOutlet('databases');
App.router.get('databasesController').loadDatabases();
}
}),
database: Ember.Route.extend({
route: "/databases/:db_name",
connectOutlets: function(router, db) {
var applicationController = router.get('applicationController');
applicationController.connectOutlet('database', db);
}
})
})
鏈接到行動 '秀':{{ action show db href=true }}
STATEMANAGER: Entering root ember-1.0.0-pre.2.min.js:18 STATEMANAGER: Sending event 'navigateAway' to state root. ember-1.0.0-pre.2.min.js:18 STATEMANAGER: Sending event 'unroutePath' to state root. ember-1.0.0-pre.2.min.js:18 STATEMANAGER: Sending event 'routePath' to state root. ember-1.0.0-pre.2.min.js:18 STATEMANAGER: Entering root.index ember-1.0.0-pre.2.min.js:18 STATEMANAGER: Entering databases
然後我點擊 '顯示' 行動
STATEMANAGER: Sending event 'show' to state databases. ember-1.0.0-pre.2.min.js:18 STATEMANAGER: Entering database
現在按下瀏覽器的後退按鈕
STATEMANAGER: Sending event 'navigateAway' to state database. ember-1.0.0-pre.2.min.js:18 STATEMANAGER: Sending event 'unroutePath' to state database. ember-1.0.0-pre.2.min.js:18 STATEMANAGER: Sending event 'routePath' to state database.
爲什麼這是狀態數據庫?我想這是因爲transitionTo('database')
在show action中。什麼是黃金通道成功地顯示項目列表中,單擊一個,並得到詳細視圖,比點擊「返回」,返回列表視圖?
薩米,我會通過嵌套'databases'和'了'root'路線內database'路線開始。 – mehulkar
真棒。你是對的! – Sammy
不錯,很高興它的工作:) – mehulkar