首先,定义一个指令:
App.directive("datePicker1", function () {
return {restrict: "AE",
link: function (scope, element, attr) {
element.bind("click", function () {
window.WdatePicker({
onpicked: function () {
scope.$apply(scope.model_Startdate = this.value);
}
})
})
}
}
});
html页面中:
<div class="col-md-10">
<input name="model_StartDate" type="datetime" placeholder="请输入课程开始日期" ng-model="model_Startdate" class="form-control" required="" date-picker1>
</input>
<span ng-show="validateInput('model_StartDate', 'required')" class="text-danger">不能为空</span>
</div>