13 lines
2.8 KiB
JavaScript
13 lines
2.8 KiB
JavaScript
/*
|
|
AngularJS v1.4.13
|
|
(c) 2010-2015 Google, Inc. http://angularjs.org
|
|
License: MIT
|
|
*/
|
|
(function(z,b,A){'use strict';function m(b){return["$animate",function(r){return{restrict:"AE",transclude:"element",terminal:!0,require:"^^ngMessages",link:function(n,e,a,f,l){var g=e[0],p,b=a.ngMessage||a.when;a=a.ngMessageExp||a.whenExp;var k=function(d){p=d?w(d)?d:d.split(/[\s,]+/):null;f.reRender()};a?(k(n.$eval(a)),n.$watchCollection(a,k)):k(b);var h,q;f.register(g,q={test:function(d){var a=p;d=a?w(a)?0<=a.indexOf(d):a.hasOwnProperty(d):void 0;return d},attach:function(){h||l(n,function(d){r.enter(d,
|
|
null,e);h=d;var a=h.$$attachId=f.getAttachId();h.on("$destroy",function(){h&&h.$$attachId===a&&(f.deregister(g),q.detach())})})},detach:function(){if(h){var d=h;h=null;r.leave(d)}}})}}}]}var w=b.isArray,t=b.forEach,x=b.isString,y=b.element;b.module("ngMessages",[]).directive("ngMessages",["$animate",function(b){function r(e,a){return x(a)&&0===a.length||n(e.$eval(a))}function n(e){return x(e)?e.length:!!e}return{require:"ngMessages",restrict:"AE",controller:["$element","$scope","$attrs",function(e,
|
|
a,f){function l(d,a){for(var c=a,e=[];c&&c!==d;){var g=c.$$ngMessageNode;if(g&&g.length)return k[g];c.childNodes.length&&-1==e.indexOf(c)?(e.push(c),c=c.childNodes[c.childNodes.length-1]):c.previousSibling?c=c.previousSibling:(c=c.parentNode,e.push(c))}}var g=this,p=0,m=0;this.getAttachId=function(){return m++};var k=this.messages={},h,q;this.render=function(d){d=d||{};h=!1;q=d;for(var k=r(a,f.ngMessagesMultiple)||r(a,f.multiple),c=[],p={},s=g.head,l=!1,m=0;null!=s;){m++;var u=s.message,v=!1;l||t(d,
|
|
function(d,a){!v&&n(d)&&u.test(a)&&!p[a]&&(v=p[a]=!0,u.attach())});v?l=!k:c.push(u);s=s.next}t(c,function(a){a.detach()});c.length!==m?b.setClass(e,"ng-active","ng-inactive"):b.setClass(e,"ng-inactive","ng-active")};a.$watchCollection(f.ngMessages||f["for"],g.render);e.on("$destroy",function(){t(k,function(a){a.message.detach()})});this.reRender=function(){h||(h=!0,a.$evalAsync(function(){h&&q&&g.render(q)}))};this.register=function(a,h){var c=p.toString();k[c]={message:h};var f=e[0],b=k[c];g.head?
|
|
(f=l(f,a))?(b.next=f.next,f.next=b):(b.next=g.head,g.head=b):g.head=b;a.$$ngMessageNode=c;p++;g.reRender()};this.deregister=function(a){var b=a.$$ngMessageNode;delete a.$$ngMessageNode;var c=k[b];(a=l(e[0],a))?a.next=c.next:g.head=c.next;delete k[b];g.reRender()}}]}}]).directive("ngMessagesInclude",["$templateRequest","$document","$compile",function(b,m,n){return{restrict:"AE",require:"^^ngMessages",link:function(e,a,f){var l=f.ngMessagesInclude||f.src;b(l).then(function(b){n(b)(e,function(b){a.after(b);
|
|
b=y(m[0].createComment(" ngMessagesInclude: "+l+" "));a.after(b);a.remove()})})}}}]).directive("ngMessage",m("AE")).directive("ngMessageExp",m("A"))})(window,window.angular);
|
|
//# sourceMappingURL=angular-messages.min.js.map
|