-
Notifications
You must be signed in to change notification settings - Fork 2
/
showErrors.min.js
executable file
·2 lines (2 loc) · 1.43 KB
/
showErrors.min.js
1
2
/*! angular-bootstrap-show-errors (version 2.0.0) 2014-10-09 */
(function(){var a;a=angular.module("ui.bootstrap.showErrors",[]),a.directive("showErrors",["$timeout","showErrorsConfig",function(a,b){var c,d,e;return d=function(a){var c;return c=b.trigger,a&&null!=a.trigger&&(c=a.trigger),c},c=function(a){var c;return c=b.showSuccess,a&&null!=a.showSuccess&&(c=a.showSuccess),c},e=function(b,e,f,g){var h,i,j,k,l,m,n,o;if(h=!1,l=b.$eval(f.showErrors),m=c(l),o=d(l),i=e[0].querySelector(".form-control[name]"),k=angular.element(i),j=k.attr("name"),!j)throw"show-errors element has no child input elements with a 'name' attribute and a 'form-control' class";return k.bind(o,function(){return h=!0,n(g[j].$invalid)}),b.$watch(function(){return g[j]&&g[j].$invalid},function(a){return h?n(a):void 0}),b.$on("show-errors-check-validity",function(){return n(g[j].$invalid)}),b.$on("show-errors-reset",function(){return a(function(){return e.removeClass("has-error"),e.removeClass("has-success"),h=!1},0,!1)}),n=function(a){return e.toggleClass("has-error",a),m?e.toggleClass("has-success",!a):void 0}},{restrict:"A",require:"^form",compile:function(a){if(!a.hasClass("form-group"))throw"show-errors element does not have the 'form-group' class";return e}}}]),a.provider("showErrorsConfig",function(){var a,b;a=!1,b="blur",this.showSuccess=function(b){return a=b},this.trigger=function(a){return b=a},this.$get=function(){return{showSuccess:a,trigger:b}}})}).call(this);