0
ember.view 객체의 자식 객체에 바인딩 문제가 있습니다. 코드는 다음과 같다 :핸들 바에 자식 ember 객체 바인딩
--Textbox 클래스는 바인딩
App.ViewTextBox = Ember.View.extend({
name:"viewName",
label:"View Label",
input: App.TextBox.extend({
placeholder:function(){
return this.get('parentView').get('label');
}.property('label').cacheable()
})});
--Handlebars App.Textbox
를 사용 Ember.TextFieldApp.TextBox = Ember.TextField.extend({
attributeBindings:['placeholder', 'autocorrect','autocapitalize'],
value:null,
isInvalid:true,
validate:function(){
this.set('isInvalid', false);
return false;
},
focusOut:function(event){
this.validate();
}});
---보기에서 확장
{{#view App.ViewTextBox}}
{{label}}<br/>
{{#view input valueBinding="parentView.value"}}
<div {{bindAttr class="isInvalid"}}></div>
{{/view}}{{/view}}
문제는 다음과 같습니다. 1)보기를 처음 렌더링 한 후에 클래스는 prope입니다. rly set이지만 onFocusOut 호출을 통해 isInvalid 값을 변경하면 DOM의 클래스가 변경되지 않습니다. 아이디어?
텍스트 필드가 없어도 동일한 문제가 발생합니다. 버그이거나 작동하지 않을 것이라고 확신합니다. – manmal