我正在尝试了解 emeber.js 路由。我不太确定,为什么这不是路由器的有效定义
Platby.Router = Ember.Router.extend
location: 'hash'
enableLogging : true
root: Ember.Route.extend
index: Ember.Route.extend
route: '/'
initialState: 'batches'
enter: (router) -> console.log 'root.index'
batches: Ember.Route.extend
initialState: 'index'
route: '/batches'
enter: (router) -> console.log 'root.index.batches'
index: Ember.Route.extend
route: '/'
enter: (router) -> console.log 'root.index.batches.index'
进入根 url 后,我会在控制台中得到以下输出。
STATEMANAGER: Entering root
STATEMANAGER: Sending event 'navigateAway' to state root.
STATEMANAGER: Sending event 'unroutePath' to state root.
STATEMANAGER: Sending event 'routePath' to state root.
Uncaught Error: assertion failed: Could not find state for path
谁能给我解释一下,问题出在哪里?