MCPcopy Index your code
hub / github.com/angular-ui/ui-grid / maxlengthDirective

Function maxlengthDirective

lib/test/angular/1.4.3/angular.js:28307–28325  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

28305
28306
28307var maxlengthDirective = function() {
28308 return {
28309 restrict: 'A',
28310 require: '?ngModel',
28311 link: function(scope, elm, attr, ctrl) {
28312 if (!ctrl) return;
28313
28314 var maxlength = -1;
28315 attr.$observe('maxlength', function(value) {
28316 var intVal = toInt(value);
28317 maxlength = isNaN(intVal) ? -1 : intVal;
28318 ctrl.$validate();
28319 });
28320 ctrl.$validators.maxlength = function(modelValue, viewValue) {
28321 return (maxlength < 0) || ctrl.$isEmpty(viewValue) || (viewValue.length <= maxlength);
28322 };
28323 }
28324 };
28325};
28326
28327var minlengthDirective = function() {
28328 return {

Callers

nothing calls this directly

Calls 1

toIntFunction · 0.70

Tested by

no test coverage detected