0
請幫助我爲jquery pttimeselect timepicker插件修正此角度指令。對JQUERY PTTIMESELECT Timepicker插件要求Angular js指令
http://pttimeselect.sourceforge.net/doc/documentation.html
Plunker鏈接: http://tinyurl.com/hr7lker
目前,我有指令如下,但得到這個錯誤 類型錯誤:無法未定義
app.directive('timePicker', function($parse) { return { restrict : "C", replace : true, transclude : false, compile : function(element, attrs) { var modelAccessor = $parse(attrs.ngModel); return function(scope, element, attrs, controller) { var processChange = function(i) { var time = i.val(); scope.$apply(function(scope) { modelAccessor.assign(scope, time); }); scope.$eval(attrs.ngChange); }; element.ptTimeSelect({ onClose : processChange }); scope.$watch(modelAccessor, function(val) { element.val(val); }); }; } }; });
謝謝!!這麼多幫助很多 – Krishna
@ masa ..請你幫忙解決下面的錯誤,我已經將Angular升級到了1.4.8,但仍然得到這個error.am無法在plunker中重現它Uncaught TypeError:Can not read property' openCntr'的未定義(匿名函數)@ jquery.ptTimeSelect.js?v = 1448900535634:471m.event.dispatch @ jquery-1.11.3.min.js:4r.handle @ jquery-1.11.3.min.js:4 ..I – Krishna
TypeError:無法讀取HTMLInputElement中未定義的 的屬性「選項」。 (http:// localhost:8080)上的(http:// localhost:8080/home/common/libs/latest/js/jquery.ptTimeSelect.js?v = 1448900535634:456:60) /home/common/libs/vendor/jquery/1.11.3/jquery-1.11.3.min.js:2:2975) at m.fn.m.each ... jquery file ... at jQuery.fn .ptTimeSelect(http:// localhost:8080/home/common/libs/js/jquery.ptTimeSelect.js?v = 1448900535634:449:21)在http:// localhost:8080/home/js/common/app。 js?v = 1448900535634:374:13 –
Krishna