【问题标题】:Require Angular js directive for JQUERY PTTIMESELECT Timepicker pluginJQUERY PTTIMESELECT Timepicker 插件需要 Angular js 指令
【发布时间】:2016-03-13 19:44:43
【问题描述】:

您能帮我纠正这个针对 Jquery pttimeselect timepicker 插件的角度指令吗?

http://pttimeselect.sourceforge.net/doc/documentation.html

Plunker 链接: http://tinyurl.com/hr7lker

目前我有如下指令,但收到此错误 TypeError:无法读取未定义的属性“选项”

app.directive('timePicker', function($parse) {
    返回 {
        限制:“C”,
        替换:真,
        嵌入:假,
        编译:函数(元素,属性){
            var modelAccessor = $parse(attrs.ngModel);

            返回函数(范围、元素、属性、控制器){
                var processChange = function(i) {
                    var time = i.val();
                    范围。$应用(功能(范围){
                        modelAccessor.assign(范围,时间);
                    });
                    scope.$eval(attrs.ngChange);
                };
                element.ptTimeSelect({
                    onClose : 进程更改
                });
                scope.$watch(modelAccessor, function(val) {
                    元素.val(val);
                });
            };
        }
    };
});

【问题讨论】:

    标签: javascript angularjs angularjs-directive timepicker jquery-ui-timepicker


    【解决方案1】:

    只需更新您的 jQuery 和 Angular 版本,它应该可以工作:

    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.js"></script>
    

    http://plnkr.co/edit/pp2Ce9CkEKYLhZtLni6p?p=preview

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-07-15
    • 1970-01-01
    • 1970-01-01
    • 2016-10-09
    • 1970-01-01
    • 1970-01-01
    • 2015-09-22
    • 2017-11-11
    相关资源
    最近更新 更多