這使我瘋了。我不能讓一個簡單的路由器工作...麻煩得到Backbone.Router使用咖啡腳本
jQuery ->
class MyRouter extends Backbone.Router
routes:
"" :"index"
"/list" :"showList"
"/item/:id" :"showItem"
index: =>
alert "index"
showList: =>
alert "get the lists"
showItem: (id)=>
alert "the item #{id}"
@app = window ? {}
@app = window.app ? {}
@app.myRouter = MyRouter
Backbone.history.start()
我總是得到這樣的錯誤: index.js:50Uncaught TypeError: Cannot call method 'start' of undefined
,我看到了這一點:Cannot call 'start' of undefined when starting backbone.js history.
,但它並沒有幫助=(...
我相信這是一個簡單的人,但我是某種卡住這裏... 請幫助...
的感謝!你救了我的一天! – silverfighter 2012-04-10 19:38:06
@silverfighter我讀過你鏈接的確切文章,試圖弄清楚爲什麼我的路由器不能在前一天工作。 :) – asawyer 2012-04-10 19:40:47