ManageIQ/manageiq-ui-classic

View on GitHub
app/javascript/oldjs/directives/validation/adjust_error_on_tab.js

Summary

Maintainability
A
0 mins
Test Coverage
ManageIQ.angular.app.directive('adjustErrorOnTab', ['$rootScope', function($rootScope) {
  return {
    link: function(scope, elem, attrs) {
      scope.$watch(attrs.adjustErrorOnTab, function(value) {
        if (value === true) {
          $rootScope.$broadcast('clearErrorOnTab', {tab: attrs.prefix});
        } else if (value === false) {
          $rootScope.$broadcast('setErrorOnTab', {tab: attrs.prefix});
        }
      });
    },
  };
}]);