Sunday, June 2, 2024
 Popular · Latest · Hot · Upcoming
50
rated 0 times [  56] [ 6]  / answers: 1 / hits: 31569  / 13 Years ago, tue, may 17, 2011, 12:00:00

I am trying to make a small app to learn how Backbone works. I took example app from source called Todo. I have created my app from scratch using snippets from Todo app. I think these apps look very similar but for some reason I can't make work some things that work fine in the example app. I get an error:



A 'url' property or function must be specified


The other problem is that I can't make this code from the example work:



this.model.bind('change', this.render);


It says there is no such a function as bind. I checked all libraries versions and code and can't realize what I do wrong. What can I do about this?


More From » jquery

 Answers
105

The TODO example is relying on localStorage thus it does not define a url (as it is local). However, when you use the default Backbone.sync implementation, you need to define a url attribute on your collections and models (it can be either static or a function). Not doing so results in the error you got.



As for the this.model.bind, I guess you lost the reference to your model somehow. Two things: this is not what you think it is or this.model is not defined. Post more code to have complete answers.


[#92197] Monday, May 16, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
stacie

Total Points: 476
Total Questions: 92
Total Answers: 102

Location: Bosnia and Herzegovina
Member since Tue, Mar 29, 2022
2 Years ago
stacie questions
Fri, Jun 26, 20, 00:00, 4 Years ago
Thu, Jan 23, 20, 00:00, 4 Years ago
Fri, Aug 30, 19, 00:00, 5 Years ago
Fri, Aug 2, 19, 00:00, 5 Years ago
;