()
| 28274 | |
| 28275 | |
| 28276 | var patternDirective = function() { |
| 28277 | return { |
| 28278 | restrict: 'A', |
| 28279 | require: '?ngModel', |
| 28280 | link: function(scope, elm, attr, ctrl) { |
| 28281 | if (!ctrl) return; |
| 28282 | |
| 28283 | var regexp, patternExp = attr.ngPattern || attr.pattern; |
| 28284 | attr.$observe('pattern', function(regex) { |
| 28285 | if (isString(regex) && regex.length > 0) { |
| 28286 | regex = new RegExp('^' + regex + '$'); |
| 28287 | } |
| 28288 | |
| 28289 | if (regex && !regex.test) { |
| 28290 | throw minErr('ngPattern')('noregexp', |
| 28291 | 'Expected {0} to be a RegExp but was {1}. Element: {2}', patternExp, |
| 28292 | regex, startingTag(elm)); |
| 28293 | } |
| 28294 | |
| 28295 | regexp = regex || undefined; |
| 28296 | ctrl.$validate(); |
| 28297 | }); |
| 28298 | |
| 28299 | ctrl.$validators.pattern = function(value) { |
| 28300 | return ctrl.$isEmpty(value) || isUndefined(regexp) || regexp.test(value); |
| 28301 | }; |
| 28302 | } |
| 28303 | }; |
| 28304 | }; |
| 28305 | |
| 28306 | |
| 28307 | var maxlengthDirective = function() { |
nothing calls this directly
no test coverage detected