

Backbone.js - Model and Views: Image Gallery Tutorial - jondot
http://blog.paracode.com/2011/08/23/image-gallery-with-backbone/

======
rgarcia
Not a backbone expert, but how "correct" is it to have a presentation variable
like "selected" tied to a backbone model? For some reason the OP's inclusion
of a "selected" attribute on his model struck me as odd. I don't think you'd
want to sync this with the backend...

~~~
jondot
That's a good question. If you think of a model representing whats behind a
view, in a non-web world (stateful), selectedness can very well sit in a model
- as long as it represents a state of the view. In this example, the
selectedness sits in the collection, however it may sit in the view. See more
about this here, for example:
[http://stackoverflow.com/questions/6519990/best-way-to-
make-...](http://stackoverflow.com/questions/6519990/best-way-to-make-one-
model-selected-in-a-backbone-js-collection)

~~~
finpingvin
Yup, can simplify code for wiring together views a great deal and promote
decoupling between them.

