我无法让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
确实有效。
答案 0 :(得分:1)
应该是Backbone.history.start(pushState: true)
,而不是pushStart
。