angular-route.min.js 5.35 KB
/*
 AngularJS v1.5.9-build.5105+sha.d80cdeb
 (c) 2010-2016 Google, Inc. http://angularjs.org
 License: MIT
*/
(function(I,e){'use strict';function A(e){h&&e.get("$route")}function B(t,u,k){return{restrict:"ECA",terminal:!0,priority:400,transclude:"element",link:function(a,f,b,d,m){function v(){p&&(k.cancel(p),p=null);l&&(l.$destroy(),l=null);n&&(p=k.leave(n),p.then(function(){p=null}),n=null)}function D(){var b=t.current&&t.current.locals;if(e.isDefined(b&&b.$template)){var b=a.$new(),d=t.current;n=m(b,function(b){k.enter(b,null,n||f).then(function(){!e.isDefined(w)||w&&!a.$eval(w)||u()});v()});l=d.scope=
b;l.$emit("$viewContentLoaded");l.$eval(h)}else v()}var l,n,p,w=b.autoscroll,h=b.onload||"";a.$on("$routeChangeSuccess",D);D()}}}function x(e,h,k){return{restrict:"ECA",priority:-400,link:function(a,f){var b=k.current,d=b.locals;f.html(d.$template);var m=e(f.contents());if(b.controller){d.$scope=a;var v=h(b.controller,d);b.controllerAs&&(a[b.controllerAs]=v);f.data("$ngControllerController",v);f.children().data("$ngControllerController",v)}a[b.resolveAs||"$resolve"]=d;m(a)}}}var y,E,F,z=e.module("ngRoute",
[]).provider("$route",function(){function t(a,f){return e.extend(Object.create(a),f)}function u(a,e){var b=e.caseInsensitiveMatch,d={originalPath:a,regexp:a},k=d.keys=[];a=a.replace(/([().])/g,"\\$1").replace(/(\/)?:(\w+)(\*\?|[\?\*])?/g,function(a,b,e,d){a="?"===d||"*?"===d?"?":null;d="*"===d||"*?"===d?"*":null;k.push({name:e,optional:!!a});b=b||"";return""+(a?"":b)+"(?:"+(a?b:"")+(d&&"(.+?)"||"([^/]+)")+(a||"")+")"+(a||"")}).replace(/([\/$\*])/g,"\\$1");d.regexp=new RegExp("^"+a+"$",b?"i":"");return d}
y=e.isArray;E=e.isObject;F=e.isDefined;var k={};this.when=function(a,f){var b;b=void 0;if(y(f)){b=b||[];for(var d=0,m=f.length;d<m;d++)b[d]=f[d]}else if(E(f))for(d in b=b||{},f)if("$"!==d.charAt(0)||"$"!==d.charAt(1))b[d]=f[d];b=b||f;e.isUndefined(b.reloadOnSearch)&&(b.reloadOnSearch=!0);e.isUndefined(b.caseInsensitiveMatch)&&(b.caseInsensitiveMatch=this.caseInsensitiveMatch);k[a]=e.extend(b,a&&u(a,b));a&&(d="/"===a[a.length-1]?a.substr(0,a.length-1):a+"/",k[d]=e.extend({redirectTo:a},u(d,b)));return this};
this.caseInsensitiveMatch=!1;this.otherwise=function(a){"string"===typeof a&&(a={redirectTo:a});this.when(null,a);return this};h=!0;this.eagerInstantiationEnabled=function(a){return F(a)?(h=a,this):h};this.$get=["$rootScope","$location","$routeParams","$q","$injector","$templateRequest","$sce",function(a,f,b,d,m,h,u){function l(c){var g=q.current;(y=(s=B())&&g&&s.$$route===g.$$route&&e.equals(s.pathParams,g.pathParams)&&!s.reloadOnSearch&&!C)||!g&&!s||a.$broadcast("$routeChangeStart",s,g).defaultPrevented&&
c&&c.preventDefault()}function n(){var c=q.current,g=s;if(y)c.params=g.params,e.copy(c.params,b),a.$broadcast("$routeUpdate",c);else if(g||c){C=!1;q.current=g;var G=d.resolve(g);G.then(p).then(w).then(function(d){return d&&G.then(z).then(function(d){g===q.current&&(g&&(g.locals=d,e.copy(g.params,b)),a.$broadcast("$routeChangeSuccess",g,c))})}).catch(function(b){g===q.current&&a.$broadcast("$routeChangeError",g,c,b)})}}function p(c){var g={route:c,hasRedirection:!1};if(c)if(c.redirectTo)if(e.isString(c.redirectTo))g.path=
x(c.redirectTo,c.params),g.search=c.params,g.hasRedirection=!0;else{var a=f.path(),b=f.search();c=c.redirectTo(c.pathParams,a,b);e.isDefined(c)&&(g.url=c,g.hasRedirection=!0)}else if(c.resolveRedirectTo)return d.resolve(m.invoke(c.resolveRedirectTo)).then(function(c){e.isDefined(c)&&(g.url=c,g.hasRedirection=!0);return g});return g}function w(c){var a=!0;if(c.route!==q.current)a=!1;else if(c.hasRedirection){var b=f.url(),e=c.url;e?f.url(e).replace():e=f.path(c.path).search(c.search).replace().url();
e!==b&&(a=!1)}return a}function z(c){if(c){var a=e.extend({},c.resolve);e.forEach(a,function(c,b){a[b]=e.isString(c)?m.get(c):m.invoke(c,null,null,b)});c=A(c);e.isDefined(c)&&(a.$template=c);return d.all(a)}}function A(c){var a,b;e.isDefined(a=c.template)?e.isFunction(a)&&(a=a(c.params)):e.isDefined(b=c.templateUrl)&&(e.isFunction(b)&&(b=b(c.params)),e.isDefined(b)&&(c.loadedTemplateUrl=u.valueOf(b),a=h(b)));return a}function B(){var a,b;e.forEach(k,function(d,k){var r;if(r=!b){var h=f.path();r=d.keys;
var m={};if(d.regexp)if(h=d.regexp.exec(h)){for(var l=1,p=h.length;l<p;++l){var n=r[l-1],q=h[l];n&&q&&(m[n.name]=q)}r=m}else r=null;else r=null;r=a=r}r&&(b=t(d,{params:e.extend({},f.search(),a),pathParams:a}),b.$$route=d)});return b||k[null]&&t(k[null],{params:{},pathParams:{}})}function x(a,b){var d=[];e.forEach((a||"").split(":"),function(a,c){if(0===c)d.push(a);else{var e=a.match(/(\w+)(?:[?*])?(.*)/),f=e[1];d.push(b[f]);d.push(e[2]||"");delete b[f]}});return d.join("")}var C=!1,s,y,q={routes:k,
reload:function(){C=!0;var b={defaultPrevented:!1,preventDefault:function(){this.defaultPrevented=!0;C=!1}};a.$evalAsync(function(){l(b);b.defaultPrevented||n()})},updateParams:function(a){if(this.current&&this.current.$$route)a=e.extend({},this.current.params,a),f.path(x(this.current.$$route.originalPath,a)),f.search(a);else throw H("norout");}};a.$on("$locationChangeStart",l);a.$on("$locationChangeSuccess",n);return q}]}).run(A),H=e.$$minErr("ngRoute"),h;A.$inject=["$injector"];z.provider("$routeParams",
function(){this.$get=function(){return{}}});z.directive("ngView",B);z.directive("ngView",x);B.$inject=["$route","$anchorScroll","$animate"];x.$inject=["$compile","$controller","$route"]})(window,window.angular);
//# sourceMappingURL=angular-route.min.js.map