beccabroek | a09cc2d | 2019-01-23 14:26:55 -0600 | [diff] [blame] | 1 | angular.module('app.common.directives').directive('hasError', function() { |
2 | return { | ||||
3 | scope: {hasError: '='}, | ||||
4 | require: 'ngModel', | ||||
5 | link: function(scope, elm, attrs, ngModel) { | ||||
6 | scope.$watch('hasError', function(value) { | ||||
7 | ngModel.$setValidity('hasError', value ? false : true); | ||||
8 | }); | ||||
9 | } | ||||
10 | }; | ||||
11 | }); |