我注意到,在我的应用程序中,当我使用下面的代码时,我在日期选择器小部件中给出了格式化的日期,但是当我单击搜索时,控制台显示空字符串。但是,如果我删除didInsertElement
方法我失去的日期选择器弹出,但绑定仍然存在,该控制台显示我输入的日期。为什么当我使用bootstrap datepicker时,Ember.js会丢失valueBinding?
在我的车把模板
{{view App.DateField valueBinding="controller.startDate" classNames="startDate"}}
{{view App.DateField valueBinding="controller.endDate" classNames="endDate"}}
<button {{action "search" target='controller'}}>Search</button>
在我的应用程序
App.ApplicationController = Ember.ArrayController.extend({
search: function() {
console.log(this.get('startDate'));
return console.log(this.get('endDate'));
}
});
App.DateField = Ember.TextField.extend({
didInsertElement: function() {
return this.$().datepicker();
}
});
当我设置didInsertElement
时,有什么想法让我失去数据绑定?
版本: bootstrap-datepicker,
handlebars-1.0.0-rc.3
ember-1.0.0-rc.3
jQuery 1.9.1
正在寻找相同的解决方案。谢谢+1 – Sisir 2015-01-16 17:14:44