1
app.directive('datePicker', function () {
    return {
        restrict: 'A',
        require: 'ngModel',
        scope: {
            minDate: '@',
        },
        link: function (scope, element, attr, ngModel) {

            element.val(ngModel.$viewValue);

            function onpicking(dp) {
                var date = dp.cal.getNewDateStr();
                scope.$apply(function () {
                    ngModel.$setViewValue(date);
                });
            }

            element.bind('click', function () {
                WdatePicker({
                    onpicking: onpicking,
                    dateFmt: 'yyyy-MM-dd',
                    minDate: (scope.minDate || '%y-%M-%d'),
                })
            });
        }
    };
});

Chobits
7.4k 声望171 粉丝

保卫骡博 Chobits#3780


引用和评论

0 条评论