summaryrefslogtreecommitdiffstats
path: root/app/common/directives/form-input-error.js
blob: 69b0487d12ceb993c0c3c8d8e0c2bce4ef4bbeb8 (plain)
1
2
3
4
5
6
7
8
9
10
11
angular.module('app.common.directives').directive('hasError', function() {
  return {
    scope: {hasError: '='},
    require: 'ngModel',
    link: function(scope, elm, attrs, ngModel) {
      scope.$watch('hasError', function(value) {
        ngModel.$setValidity('hasError', value ? false : true);
      });
    }
  };
});
OpenPOWER on IntegriCloud