1app.directive('datetimepicker', function ($parse) { 2 return function (scope, element, attrs, controller) { 3 var ngModel = $parse(attrs.ngModel); 4 $(function () { 5 element.datetimepicker({ 6 formatDate: 'd/m/Y', 7 onChangeDateTime: function (dateText, inst) { 8 scope.$apply(function (scope) { 9 ngModel.assign(scope, element.val()); 10 }); 11 } 12 }); 13 }); 14 } 15}); 16 17app.directive('datetimepickerwithrange', function ($parse) { 18 19 return function (scope, element, attrs, controller) { 20 var ngModel = $parse(attrs.ngModel); 21 $(function () { 22 element.datetimepicker({ 23 formatDate: 'd/m/Y', 24 minDate: scope.minDate, 25 maxDate: scope.maxDate, 26 onChangeDateTime: function (dateText, inst) { 27 scope.$apply(function (scope) { 28 ngModel.assign(scope, element.val()); 29 }); 30 } 31 }); 32 }); 33 } 34}); 35 36app.directive('datatable', function () { 37 return function (scope, element, attrs, controller) { 38 $(function () { 39 element.dataTable(); 40 }); 41 } 42}); 43 44app.directive('integer', function () { 45 return { 46 require: 'ngModel', 47 link: function (scope, ele, attr, ctrl) { 48 ctrl.$parsers.unshift(function (viewValue) { 49 return parseInt(viewValue, 10); 50 }); 51 } 52 }; 53}); 54 55app.directive('number', function () { 56 return function (scope, element, attrs) { 57 58 var keyCode = [8, 9, 37, 39, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 110]; 59 element.bind("keydown", function (event) { 60 console.log($.inArray(event.which, keyCode)); 61 if ($.inArray(event.which, keyCode) == -1) { 62 scope.$apply(function () { 63 scope.$eval(attrs.onlyNum); 64 event.preventDefault(); 65 }); 66 event.preventDefault(); 67 } 68 69 }); 70 }; 71}); 72 73 74app.directive('ngEnter', function () { 75 return function (scope, element, attrs) { 76 element.bind("keydown keypress", function (event) { 77 if (event.which === 13) { 78 scope.$apply(function () { 79 scope.$eval(attrs.ngEnter); 80 }); 81 82 event.preventDefault(); 83 } 84 }); 85 }; 86});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.