D
D
Denis Denis2015-05-28 18:36:45
JavaScript
Denis Denis, 2015-05-28 18:36:45

How is the view attached to the model in Backbone.js?

Hello! Understanding Backbone.js. It seems clear, models, collections, views, events. But, it’s not enough, apparently, um: understand how in Backbone.js the view is attached to the model? Save, help

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Mikhail Osher, 2015-05-28
@golovewkin

No way. All by hand.

<!-- inside view init -->
this.model.on('change', function updateView() { } );

<!-- view property -->
events: {
  'input keyup': 'updateModel'
}

Or you can take a look at Backbone.ModelBinder .

D
Denis Denis, 2015-06-03
@golovewkin

I seem to have caught up.
So?
var personView = new PersonView({ model: person });

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question