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

Function maxlengthDirective

test/angular/1.3/angular.js:26394–26412  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

26392
26393
26394var maxlengthDirective = function() {
26395 return {
26396 restrict: 'A',
26397 require: '?ngModel',
26398 link: function(scope, elm, attr, ctrl) {
26399 if (!ctrl) return;
26400
26401 var maxlength = -1;
26402 attr.$observe('maxlength', function(value) {
26403 var intVal = int(value);
26404 maxlength = isNaN(intVal) ? -1 : intVal;
26405 ctrl.$validate();
26406 });
26407 ctrl.$validators.maxlength = function(modelValue, viewValue) {
26408 return (maxlength < 0) || ctrl.$isEmpty(viewValue) || (viewValue.length <= maxlength);
26409 };
26410 }
26411 };
26412};
26413
26414var minlengthDirective = function() {
26415 return {

Callers

nothing calls this directly

Calls 1

intFunction · 0.70

Tested by

no test coverage detected