How do I fetch a single model in Backbone?

前端 未结 7 1122
误落风尘
误落风尘 2020-11-30 18:36

I have a Clock model in Backbone:

var Clock = Backbone.Model.extend({});

I\'m trying to get an instance of that that has the l

7条回答
  •  南笙
    南笙 (楼主)
    2020-11-30 19:08

    Try specifying urlRoot in the model:

    From the docs:

    var Book = Backbone.Model.extend({urlRoot : '/books'});
    var solaris = new Book({id: "1083-lem-solaris"});
    solaris.fetch();
    

提交回复
热议问题