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

Function minlengthDirective

test/angular/1.5/angular.js:32439–32456  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

32437 * </example>
32438 */
32439var minlengthDirective = function() {
32440 return {
32441 restrict: 'A',
32442 require: '?ngModel',
32443 link: function(scope, elm, attr, ctrl) {
32444 if (!ctrl) return;
32445
32446 var minlength = 0;
32447 attr.$observe('minlength', function(value) {
32448 minlength = toInt(value) || 0;
32449 ctrl.$validate();
32450 });
32451 ctrl.$validators.minlength = function(modelValue, viewValue) {
32452 return ctrl.$isEmpty(viewValue) || viewValue.length >= minlength;
32453 };
32454 }
32455 };
32456};
32457
32458if (window.angular.bootstrap) {
32459 //AngularJS is already loaded, so we can return here...

Callers

nothing calls this directly

Calls 1

toIntFunction · 0.70

Tested by

no test coverage detected