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

Function minlengthDirective

test/angular/1.4/angular.js:29670–29687  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

29668 * </example>
29669 */
29670var minlengthDirective = function() {
29671 return {
29672 restrict: 'A',
29673 require: '?ngModel',
29674 link: function(scope, elm, attr, ctrl) {
29675 if (!ctrl) return;
29676
29677 var minlength = 0;
29678 attr.$observe('minlength', function(value) {
29679 minlength = toInt(value) || 0;
29680 ctrl.$validate();
29681 });
29682 ctrl.$validators.minlength = function(modelValue, viewValue) {
29683 return ctrl.$isEmpty(viewValue) || viewValue.length >= minlength;
29684 };
29685 }
29686 };
29687};
29688
29689if (window.angular.bootstrap) {
29690 //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