MCPcopy Create free account
hub / github.com/cafebazaar/blacksmith / minlengthDirective

Function minlengthDirective

web/static/bower_components/angular/angular.js:28739–28756  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

28737};
28738
28739var minlengthDirective = function() {
28740 return {
28741 restrict: 'A',
28742 require: '?ngModel',
28743 link: function(scope, elm, attr, ctrl) {
28744 if (!ctrl) return;
28745
28746 var minlength = 0;
28747 attr.$observe('minlength', function(value) {
28748 minlength = toInt(value) || 0;
28749 ctrl.$validate();
28750 });
28751 ctrl.$validators.minlength = function(modelValue, viewValue) {
28752 return ctrl.$isEmpty(viewValue) || viewValue.length >= minlength;
28753 };
28754 }
28755 };
28756};
28757
28758if (window.angular.bootstrap) {
28759 //AngularJS is already loaded, so we can return here...

Callers

nothing calls this directly

Calls 1

toIntFunction · 0.85

Tested by

no test coverage detected