我注意到在我的应用程序中,当我使用下面的代码时,我在日期选择器小部件中给出了格式化日期,但是当我单击搜索时,控制台显示空字符串.但是,如果我删除了didInsertElement方法,我将丢失datepicker弹出窗口,但数据绑定仍然存在,控制台显示我输入的日期.
在我的车把模板中
@H_301_4@{{view App.DateField valueBinding="controller.startDate" classNames="startDate"}} {{view App.DateField valueBinding="controller.endDate" classNames="endDate"}} <button {{action "search" target='controller'}}>Search</button>在我的应用程序中
@H_301_4@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时为什么会丢失数据绑定的任何想法?
@H_301_4@handlebars-1.0.0-rc.3 ember-1.0.0-rc.3 jQuery 1.9.1