Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

backbonejs view without a model

Can I have a view without a model?

I just want to render some data with the backbone view that I'm familiar with. The data doesn't map to a REST url or some model.

Can I do that or should I just make a model anyway?

like image 830
Harry Avatar asked Jan 25 '12 03:01

Harry


2 Answers

You don't always need a model.

Models and views don't have to be 1:1. In fact, they probably rarely are in practice. Some views might render data for several different models. Others might not, and instead might listen for DOM events, or render data from a third-party source, or any number of other things that don't require a model.

like image 59
Rob Hruska Avatar answered Oct 05 '22 20:10

Rob Hruska


Models and Views are not tied together. There are no dependencies between the other.

You don't have to have a model to make a view.

You can just make Backbone render your data using the backbone's view.

like image 26
Jan Carlo Viray Avatar answered Oct 05 '22 18:10

Jan Carlo Viray