关于angularjs中的时间控件datepicker

来源:互联网 发布:网贷大数据查询系统 编辑:程序博客网 时间:2024/06/05 15:07

首先,定义一个指令:

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>


0 0