admin管理员组

文章数量:1316518

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?

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?

Share Improve this question asked Jan 25, 2012 at 3:04 HarryHarry 55k76 gold badges185 silver badges270 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 9

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.

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.

本文标签: javascriptbackbonejs view without a modelStack Overflow