【问题标题】:unable to call jquery datetimepicker function in custom directive无法在自定义指令中调用 jquery datetimepicker 函数
【发布时间】:2014-12-10 19:37:55
【问题描述】:

我在 angularJs 中创建了一个自定义指令,用于显示 datetimepicker。

app.directive("timePicker", function() {
            return {
                restrict: "A",
                link: function(scope, elem, attrs) {
                    //On click
                    $(elem).click(function() {
                        $(this).datetimepicker();
                    });
                }
            };
        });

在 html 中这样使用它

<div>
            <input type="text" name="basic_example_1" id="basic_example_1" value="" class="hasDatepicker" 
            time-picker>
        </div>

我正在使用以下 js 文件。

<script src='appResources/js/jquery-ui-sliderAccess.js'></script> 
<script src='appResources/js/jquery-ui-timepicker-addon.js'></script>
<script src='appResources/js/jquery-ui-timepicker-addon-i18n.min.js'></script>
<link href="appResources/css/jquery-ui-timepicker-addon.css" rel="stylesheet" />

我指的是从这个站点获取 datetimepicker here

【问题讨论】:

标签: javascript jquery angularjs angularjs-directive


【解决方案1】:

尝试只使用:

jquery-ui-timepicker-addon.js

并检查控制台日志,可能有错误

【讨论】:

    猜你喜欢
    • 2020-10-28
    • 2019-09-17
    • 2014-01-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-06-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多