How to fetch a Backbone.js model by something other than the ID?

前端 未结 5 1271
-上瘾入骨i
-上瘾入骨i 2021-02-15 14:48

Backbone.js\'s default, RESTful approach to fetching a model by the ID is easy and straight-forward. However, I can\'t seem to find any examples of fetching a model by a differe

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-15 15:17

    If the model is part of a collection you can use where() to pull out the models matching some criteria.

    See http://backbonejs.org/#Collection-where

提交回复
热议问题