0
我有兩個資源Routers
:Students
和Colleges
。如何初始化多個路由器?
class App.Routers.Colleges extends Backbone.Router
routes:
"index": 'index'
class App.Routers.Students extends Backbone.Router
routes:
'index': 'index'
'new': 'newStudent'
如何初始化這兩條路線,使它們工作?
我試圖初始化像下面的代碼,但它不工作。
window.App =
Models: {}
Collections: {}
Views: {}
Routers: {}
initialize: ->
new App.Routers.Students
new App.Routers.Colleges
Backbone.history.start()
$(document).ready ->
App.initialize()
當我試圖運行上面的代碼,它只是顯示我的數據new App.Routers.Colleges
兩個院校和學生股利。