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

Function minlengthDirective

lib/test/angular/1.6.7/angular.js:34009–34026  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

34007 * </example>
34008 */
34009var minlengthDirective = function() {
34010 return {
34011 restrict: 'A',
34012 require: '?ngModel',
34013 link: function(scope, elm, attr, ctrl) {
34014 if (!ctrl) return;
34015
34016 var minlength = 0;
34017 attr.$observe('minlength', function(value) {
34018 minlength = toInt(value) || 0;
34019 ctrl.$validate();
34020 });
34021 ctrl.$validators.minlength = function(modelValue, viewValue) {
34022 return ctrl.$isEmpty(viewValue) || viewValue.length >= minlength;
34023 };
34024 }
34025 };
34026};
34027
34028if (window.angular.bootstrap) {
34029 // 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