mirror of
https://github.com/wahyd4/cdnjs.git
synced 2026-08-25 12:46:01 +10:00
Sources: http://code.angularjs.org/* Added missing versions, fixed some files reporting as min’d but weren’t, the sneaky varmints. Addresses https://github.com/cdnjs/cdnjs/issues/1188 - I think. Can be closed if it does.
1 line
3.6 KiB
JavaScript
Executable File
1 line
3.6 KiB
JavaScript
Executable File
(function(c,b,f){var e=b.module("ngRoute",["ng"]).provider("$route",g);function g(){function j(l,k){return b.extend(new (b.extend(function(){},{prototype:l}))(),k)}var h={};this.when=function(m,l){h[m]=b.extend({reloadOnSearch:true},l,m&&i(m,l));if(m){var k=(m[m.length-1]=="/")?m.substr(0,m.length-1):m+"/";h[k]=b.extend({redirectTo:m},i(k,l))}return this};function i(o,n){var k=n.caseInsensitiveMatch,l={originalPath:o,regexp:o},m=l.keys=[];o=o.replace(/([().])/g,"\\$1").replace(/(\/)?:(\w+)([\?|\*])?/g,function(q,s,r,t){var p=t==="?"?t:null;var u=t==="*"?t:null;m.push({name:r,optional:!!p});s=s||"";return""+(p?"":s)+"(?:"+(p?s:"")+(u&&"(.+?)"||"([^/]+)")+(p||"")+")"+(p||"")}).replace(/([\/$\*])/g,"\\$1");l.regexp=new RegExp("^"+o+"$",k?"i":"");return l}this.otherwise=function(k){this.when(null,k);return this};this.$get=["$rootScope","$location","$routeParams","$q","$injector","$http","$templateCache","$sce",function(v,o,w,p,x,s,k,u){var m=false,t={routes:h,reload:function(){m=true;v.$evalAsync(r)}};v.$on("$locationChangeSuccess",r);return t;function l(D,E){var G=E.keys,A={};if(!E.regexp){return null}var z=E.regexp.exec(D);if(!z){return null}for(var B=1,C=z.length;B<C;++B){var F=G[B-1];var y="string"==typeof z[B]?decodeURIComponent(z[B]):z[B];if(F&&y){A[F.name]=y}}return A}function r(){var y=n(),z=t.current;if(y&&z&&y.$$route===z.$$route&&b.equals(y.pathParams,z.pathParams)&&!y.reloadOnSearch&&!m){z.params=y.params;b.copy(z.params,w);v.$broadcast("$routeUpdate",z)}else{if(y||z){m=false;v.$broadcast("$routeChangeStart",y,z);t.current=y;if(y){if(y.redirectTo){if(b.isString(y.redirectTo)){o.path(q(y.redirectTo,y.params)).search(y.params).replace()}else{o.url(y.redirectTo(y.pathParams,o.path(),o.search())).replace()}}}p.when(y).then(function(){if(y){var C=b.extend({},y.resolve),A,B;b.forEach(C,function(E,D){C[D]=b.isString(E)?x.get(E):x.invoke(E)});if(b.isDefined(A=y.template)){if(b.isFunction(A)){A=A(y.params)}}else{if(b.isDefined(B=y.templateUrl)){if(b.isFunction(B)){B=B(y.params)}B=u.getTrustedResourceUrl(B);if(b.isDefined(B)){y.loadedTemplateUrl=B;A=s.get(B,{cache:k}).then(function(D){return D.data})}}}if(b.isDefined(A)){C["$template"]=A}return p.all(C)}}).then(function(A){if(y==t.current){if(y){y.locals=A;b.copy(y.params,w)}v.$broadcast("$routeChangeSuccess",y,z)}},function(A){if(y==t.current){v.$broadcast("$routeChangeError",y,z,A)}})}}}function n(){var z,y;b.forEach(h,function(A,B){if(!y&&(z=l(o.path(),A))){y=j(A,{params:b.extend({},o.search(),z),pathParams:z});y.$$route=A}});return y||h[null]&&j(h[null],{params:{},pathParams:{}})}function q(z,A){var y=[];b.forEach((z||"").split(":"),function(D,C){if(C===0){y.push(D)}else{var E=D.match(/(\w+)(.*)/);var B=E[1];y.push(A[B]);y.push(E[2]||"");delete A[B]}});return y.join("")}}]}e.provider("$routeParams",d);function d(){this.$get=function(){return{}}}e.directive("ngView",a);a.$inject=["$route","$anchorScroll","$compile","$controller","$animate"];function a(l,j,i,h,k){return{restrict:"ECA",terminal:true,priority:400,transclude:"element",compile:function(n,m,o){return function(w,v,s){var x,q,r=s.autoscroll,u=s.onload||"";w.$on("$routeChangeSuccess",p);p();function t(){if(x){x.$destroy();x=null}if(q){k.leave(q);q=null}}function p(){var A=l.current&&l.current.locals,y=A&&A.$template;if(y){var z=w.$new();o(z,function(F){F.html(y);k.enter(F,null,q||v,function B(){if(b.isDefined(r)&&(!r||w.$eval(r))){j()}});t();var D=i(F.contents()),E=l.current;x=E.scope=z;q=F;if(E.controller){A.$scope=x;var C=h(E.controller,A);if(E.controllerAs){x[E.controllerAs]=C}F.data("$ngControllerController",C);F.children().data("$ngControllerController",C)}D(x);x.$emit("$viewContentLoaded");x.$eval(u)})}else{t()}}}}}}})(window,window.angular); |