无法获得 Marionette 上班路线
Can't get Marionette Routing to Work
我无法Marionette路由工作
@Arc = do(Backbone, Marionette) ->
App = new Marionette.Application
API =
listContacts: ()->
console.log "from listContacts"
class MyRouter extends Marionette.AppRouter
appRoutes:
"notes" : "listContacts"
controller: API
App.router = new MyRouter()
App.on 'start', ->
console.log "in on start"
if Backbone.history
Backbone.history.start(pushStart: true)
App
console.log "before"
@Arc.start()
console.log "after"
访问 localhost:3000/notes
不会记录消息 from listContacts
。如果我转向 pushState: false
访问 localhost:3000/#notes
确实有效。
应该是Backbone.history.start(pushState: true)
,不是pushStart
。
我无法Marionette路由工作
@Arc = do(Backbone, Marionette) ->
App = new Marionette.Application
API =
listContacts: ()->
console.log "from listContacts"
class MyRouter extends Marionette.AppRouter
appRoutes:
"notes" : "listContacts"
controller: API
App.router = new MyRouter()
App.on 'start', ->
console.log "in on start"
if Backbone.history
Backbone.history.start(pushStart: true)
App
console.log "before"
@Arc.start()
console.log "after"
访问 localhost:3000/notes
不会记录消息 from listContacts
。如果我转向 pushState: false
访问 localhost:3000/#notes
确实有效。
应该是Backbone.history.start(pushState: true)
,不是pushStart
。