Ember.js(1.0) で自分自身からビュー クラスとバインド プロパティを作成する方法は? このようなもの:
SomeClass = Ember.View.extend
someProp: true
createChildView: ->
OtherView.create
somePropBinding: 'this.someProp'
Ember.js(1.0) で自分自身からビュー クラスとバインド プロパティを作成する方法は? このようなもの:
SomeClass = Ember.View.extend
someProp: true
createChildView: ->
OtherView.create
somePropBinding: 'this.someProp'
のプロパティparentView
へのアクセスを取得するために使用すると、次のように動作するはずです。parentView
例:
App.MyView = Ember.ContainerView.extend({
someProp: true,
didInsertElement: function() {
var viewClass = App.SomeView.create();
this.pushObject(viewClass);
}
});
次にEmber.computed.alias('...)
、バインディングを作成するために使用できます。
App.SomeView = Ember.View.extend({
anotherProp: Ember.computed.alias('parentView.someProp'),
didInsertElement: function() {
console.log('anotherProp: '+this.get('anotherProp'));
}
});
コードをスクリプト化しなくてすみません:)
実施例。
それが役に立てば幸い。