From couple of days, I have started working/learning the [backbone.js]. I have read documentation on their site. I have also read few tutorials available [here].
As per my understanding below are few major differences between Views and Models.
- Only view has 'el'. *Why it is not there in Model ?*
- Only Models have 'get','set', 'save' methods.
- Only Models have functions like fetch, save, destroy, validate
According Hello World examples [here], View can also do the things Models can do.
- Both have extend, render, initializer, getter setter methods.
- Both can be converted into JSON using toJSON.
hence, I am confused between Models and Views. When to use each one ?
my question is.. *what is practical difference between Models and Views? What are different situations to use Models/Views ? What should be appropriate to use for displaying(render)?*
*Can anyone good @ Backbone.js explain with practical scenario* ?
Your help will make my understanding much clear.
: http://arturadib.com/hello-backbonejs/ a very nice resource to backbone is backbonetutorials.com it is very helpful when you are beginning to play with the framework
以上就是Models vs Views in Backbone.js的详细内容，更多请关注web前端其它相关文章！