ManageIQ.angular.app.directive('validationStatus', function() {
  return {
    require: 'ngModel',
    link: function (scope, elem, attrs, ctrl) {
      ctrl.$validators.validationRequired = function (modelValue, viewValue) {
        if (angular.isDefined(viewValue) && viewValue === true) {
          scope.postValidationModelRegistry(attrs.prefix);
          return true;
        }
        return false;
      };
    }
  }
});

ManageIQ.angular.app.directive('validationStatus', ['$rootScope', function($rootScope) {
  return {
    require: 'ngModel',
    link: function (scope, elem, attrs, ctrl) {
      ctrl.$validators.validationRequired = function (modelValue, viewValue) {
        if (angular.isDefined(viewValue) && viewValue === true) {
          scope.postValidationModelRegistry(attrs.prefix);
          return true;
        } else {
          $rootScope.$broadcast('setErrorOnTab', {tab: attrs.prefix});
          return false;
        }
      };
    }
  }
}]);

Mark the tab with the error indicator the moment error is detected
Mark the tab with the error indicator the moment error is detected
