建议使用AngularJS directive指令,通过onpicked(选中后触发)和oncleared(点击清除按钮触发)两个回调函数来触发元素的change事件,AngularJS就可以获取到日期值了,代码如下:
var app = angular.module("root",[]);
app.directive('wdatePicker',function(){
return{
restrict:"A",
link:function(scope,element,attr){
element.bind('click',function(){
window.WdatePicker({
onpicked: function(){element.change()},
oncleared:function(){element.change()}
})
});
}
}
});
引用指令wdate-picker指令
<input class="form-control" ng-model="date" wdate-picker placeholder="请输入时间">