0
我有这样的代码在我的路由器:Backbone.js的 - 网址:ID没有获得通过到循环
category: (id) ->
alert id
filteredProducts = new App.Collections.Products(@productsCollection.where({category_id: id}))
@productsView.renderResults(filteredProducts)
的alert id
调用工作正常(如app.com/categories/6>警报“6” ),当我在where
功能改变id
到实际数量的产品收集过滤正常,像这样:
filteredProducts = new App.Collections.Products(@productsCollection.where({designer_id: 6}))
但是,当我设置designer_id: id
的地方环路返回一个空的集合。
难道是你在第二个调用'Altar.Collections.Pieces',但是第一个调用'App.Collections.Pieces'? – tkone
不,不是。我的应用程序被命名为祭坛,但为了减少我在我的帖子中将Altar重命名为App的混淆,但忘记在第二次调用中更改它。我的错!更改了原始帖子以更正此问题。 –