首页 > Web开发 > 详细

Angularjs日期格式指令+jqueryui_datepicker

时间:2016-01-21 11:59:13      阅读:212      评论:0      收藏:0      [点我收藏+]

jquery引用datepicker

$("#datepicker").datepicker({ dateFormat: "yy-mm-dd" });

初始化加载定义格式指令

App.directive(‘dateFormat‘, function () {
    return {
        restrict: ‘A‘,
        require: ‘ngModel‘,
        link: function (scope, element, attr, ngmodel) {
            function formatValue(value) {
                if (!value) {
                    return value;
                }
                return $.datepicker.formatDate(attr["dateFormat"], new Date(value));
            }
            ngmodel.$formatters.push(formatValue);
        }
    }
})

 

Angularjs日期格式指令+jqueryui_datepicker

原文:http://www.cnblogs.com/sssleon/p/5147640.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!