MCPcopy Create free account
hub / github.com/EricSimons/ionic-course / minlengthDirective

Function minlengthDirective

code/songhop/www/lib/angular/angular.js:21309–21326  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

21307};
21308
21309var minlengthDirective = function() {
21310 return {
21311 restrict: 'A',
21312 require: '?ngModel',
21313 link: function(scope, elm, attr, ctrl) {
21314 if (!ctrl) return;
21315
21316 var minlength = 0;
21317 attr.$observe('minlength', function(value) {
21318 minlength = int(value) || 0;
21319 ctrl.$validate();
21320 });
21321 ctrl.$validators.minlength = function(modelValue, viewValue) {
21322 return ctrl.$isEmpty(viewValue) || viewValue.length >= minlength;
21323 };
21324 }
21325 };
21326};
21327
21328
21329/**

Callers

nothing calls this directly

Calls 1

intFunction · 0.70

Tested by

no test coverage detected