したがって、Backbone.js から拡張されたオブジェクトがいくつかあります。
var MyModel = Backbone.Model.extend({});
var modelInstance = new MyModel();
var MyModelView = Backbone.View.extend({});
そして、モデルを対応するビューにバインドする方法を見つけようとしています。バックボーンでのデータバインディングの処理方法は?
したがって、Backbone.js から拡張されたオブジェクトがいくつかあります。
var MyModel = Backbone.Model.extend({});
var modelInstance = new MyModel();
var MyModelView = Backbone.View.extend({});
そして、モデルを対応するビューにバインドする方法を見つけようとしています。バックボーンでのデータバインディングの処理方法は?
ビューを作成するときに、モデル インスタンスをビューに渡します。
var modelView = new MyModelView({model: modelInstance})
ドキュメントから:
When creating a new View, the options you pass — after being merged into any default
options already present on the view — are attached to the view as this.options
for future reference. There are several special options that, if passed, will be
attached directly to the view: model, collection, el, id, className, tagName and attributes.