MCPcopy Create free account
hub / github.com/angular-ui/ui-grid / minlengthDirective

Function minlengthDirective

lib/test/angular/1.5.0/angular.js:30248–30265  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

30246 * </example>
30247 */
30248var minlengthDirective = function() {
30249 return {
30250 restrict: 'A',
30251 require: '?ngModel',
30252 link: function(scope, elm, attr, ctrl) {
30253 if (!ctrl) return;
30254
30255 var minlength = 0;
30256 attr.$observe('minlength', function(value) {
30257 minlength = toInt(value) || 0;
30258 ctrl.$validate();
30259 });
30260 ctrl.$validators.minlength = function(modelValue, viewValue) {
30261 return ctrl.$isEmpty(viewValue) || viewValue.length >= minlength;
30262 };
30263 }
30264 };
30265};
30266
30267if (window.angular.bootstrap) {
30268 //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