簡體   English   中英

無法在自定義指令中調用jquery datetimepicker函數

[英]unable to call jquery datetimepicker function in custom directive

我在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 這里

嘗試僅使用:

jquery-ui-timepicker-addon.js

並檢查控制台日志,也許有錯誤

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM