【发布时间】:2016-12-20 03:00:08
【问题描述】:
我在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 中的大学和学生 div 中的数据。
【问题讨论】:
标签: javascript backbone.js coffeescript backbone-routing