Harry
Harry

Reputation: 54939

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?

Upvotes: 5

Views: 2289

Answers (2)

Jan Carlo Viray
Jan Carlo Viray

Reputation: 12122

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.

Upvotes: 1

Rob Hruska
Rob Hruska

Reputation: 120286

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.

Upvotes: 9

Related Questions