@uirouter/angular
Advanced tools
Comparing version 1.0.0-beta.7-SNAPSHOT.20170812 to 1.0.0-rc.0
/** | ||
* State-based routing for Angular | ||
* @version v1.0.0-beta.7-SNAPSHOT.20170812 | ||
* @version v1.0.0-rc.0 | ||
* @link https://ui-router.github.io/ng2 | ||
* @license MIT License, http://www.opensource.org/licenses/MIT | ||
*/ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common"),require("@uirouter/core"),require("rxjs/ReplaySubject"),require("rxjs/BehaviorSubject"),require("rxjs/observable/of"),require("rxjs/observable/fromPromise"),require("rxjs/observable/combineLatest"),require("rxjs/operator/switchMap"),require("rxjs/operator/map"),require("rxjs/operator/concat"),require("@angular/router"),require("rxjs/add/operator/mergeMap"),require("rxjs/add/operator/map")):"function"==typeof define&&define.amd?define(["exports","@angular/core","@angular/common","@uirouter/core","rxjs/ReplaySubject","rxjs/BehaviorSubject","rxjs/observable/of","rxjs/observable/fromPromise","rxjs/observable/combineLatest","rxjs/operator/switchMap","rxjs/operator/map","rxjs/operator/concat","@angular/router","rxjs/add/operator/mergeMap","rxjs/add/operator/map"],t):t(e["@uirouter/angular"]=e["@uirouter/angular"]||{},e.ng.core,e.ng.common,e["@uirouter/core"],e.Rx,e.Rx,e.Rx.Observable,e.Rx.Observable,e.rxjs_observable_combineLatest,e.rxjs_operator_switchMap,e.Rx.Observable.prototype,e.rxjs_operator_concat,e._angular_router)}(this,function(e,t,r,n,o,i,a,s,u,c,p,f,l){"use strict";function h(e){var t={},r=e.views||{$default:n.pick(e,["component","bindings"])};return n.forEach(r,function(r,o){if(o=o||"$default",n.isFunction(r)&&(r={component:r}),0!=Object.keys(r).length){r.$type="ng2",r.$context=e,r.$name=o;var i=n.ViewService.normalizeUIViewTarget(r.$context,r.$name);r.$uiViewName=i.uiViewName,r.$uiViewContextAnchor=i.uiViewContextAnchor,t[o]=r}}),t}function d(e,t,r){return void 0===r&&(r={}),n.isFunction(r.config)&&r.config(e,t,r),(r.states||[]).map(function(t){return e.stateRegistry.register(t)})}function g(e,t,r){n.isDefined(r.deferIntercept)&&e.urlService.deferIntercept(r.deferIntercept),n.isDefined(r.otherwise)&&e.urlService.rules.otherwise(r.otherwise)}function v(e,t){return t.map(function(r){return e.concat(n.PathUtils.subPath(t,function(e){return e.state===r.state}))})}function y(e,t){var r=K(t),o=e.trans.treeChanges(),i="start"===e.evt,a="success"===e.evt,s=a?o.to:o.from;return{active:function(){return v([],s).map(r).reduce(n.anyTrueR,!1)}(),exact:function(){return r(s)}(),entering:!!i&&function(){return v(o.retained,o.entering).map(r).reduce(n.anyTrueR,!1)}(),exiting:!!i&&function(){return v(o.retained,o.exiting).map(r).reduce(n.anyTrueR,!1)}()}}function m(e,t){return{active:e.active||t.active,exact:e.exact||t.exact,entering:e.entering||t.entering,exiting:e.exiting||t.exiting}}function R(e){return[{provide:W,useValue:e,multi:!0},{provide:X,useValue:e,multi:!0},{provide:l.ROUTES,useValue:e.states||[],multi:!0},{provide:t.ANALYZE_FOR_ENTRY_COMPONENTS,useValue:e.states||[],multi:!0}]}function b(e){return[{provide:X,useValue:e,multi:!0},{provide:l.ROUTES,useValue:e.states||[],multi:!0},{provide:t.ANALYZE_FOR_ENTRY_COMPONENTS,useValue:e.states||[],multi:!0}]}function _(e){return{provide:r.LocationStrategy,useClass:e?r.HashLocationStrategy:r.PathLocationStrategy}}function S(e){return function(t){var r=t.injector().get(n.NATIVE_INJECTOR_TOKEN),o=function(e){return e.create(r)},i=function(e){return w(t,e)};return I(e,r).then(o).then(i)}}function I(e,r){if(n.isString(e))return r.get(t.NgModuleFactoryLoader).load(e);var o=r.get(t.Compiler),i=o instanceof t.Compiler,a=function(e){return e&&e.__esModule&&e.default?e.default:e},s=function(e){return o.compileModuleAsync(e)},u=Promise.resolve(e()).then(a);return i?u:u.then(s)}function w(e,t){var r=t.injector,o=t.injector.parent||t.injector._parent,i=r.get(n.UIRouter),a=i.stateRegistry,s=e.to().name,u=a.get(s),c=/^(.*)\.\*\*$/.exec(s),p=c&&c[1],f=E(o,r,W).reduce(n.uniqR,[]),l=E(o,r,X).reduce(n.uniqR,[]);if(f.length)throw console.log(f),new Error("Lazy loaded modules should not contain a UIRouterModule.forRoot() module");var h=l.map(function(e){return d(i,r,e)}).reduce(n.unnestR,[]).reduce(n.uniqR,[]),g=a.get(p);if(!g||g===u)throw new Error("The Future State named '"+s+"' lazy loaded an NgModule. The lazy loaded NgModule must have a state named '"+p+"' which replaces the (placeholder) '"+s+"' Future State. Add a '"+p+"' state to the lazy loaded NgModule using UIRouterModule.forChild({ states: CHILD_STATES }).");return h.filter(function(e){return!n.inArray(h,e.parent)}).forEach(function(e){return e.resolvables.push(n.Resolvable.fromData(n.NATIVE_INJECTOR_TOKEN,r))}),{}}function E(e,t,r){var n=t.get(r,[]),o=e.get(r,[]);return n.filter(function(e){return-1===o.indexOf(e)})}function U(e,t){var r=e.loadChildren;return r?S(r):e.lazyLoad}function O(e,t){function r(){this.constructor=e}ne(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function x(e,o,i,a){if(1!==o.length)throw new Error("Exactly one UIRouterModule.forRoot() should be in the bootstrapped app module's imports: []");var s=new n.UIRouter;s.plugin(re),s.plugin(n.servicesPlugin),n.services.$injector.get=a.get.bind(a),s.locationService=new oe(s,e,r.isPlatformBrowser(a.get(t.PLATFORM_ID))),s.locationConfig=new ie(s,e);var u=function(e,t){return new $(e,t)};s.viewService._pluginapi._viewConfigFactory("ng2",u);var c=s.stateRegistry;c.decorator("views",h),c.decorator("lazyLoad",U);var p=n.Resolvable.fromData(n.NATIVE_INJECTOR_TOKEN,a);return c.root().resolvables.push(p),s.urlMatcherFactory.$get(),o.forEach(function(e){return g(s,a,e)}),i.forEach(function(e){return d(s,a,e)}),s.urlRouter.interceptDeferred||(s.urlService.listen(),s.urlService.sync()),s}function C(e){return{fqn:null,context:e.root()}}function T(e){return e.stateService}function j(e){return e.transitionService}function N(e){return e.urlMatcherFactory}function V(e){return e.urlRouter}function P(e){return e.urlService}function D(e){return e.viewService}function M(e){return e.stateRegistry}function A(e){return e.globals}var F=0,$=function(){function e(e,t){this.path=e,this.viewDecl=t,this.$id=F++,this.loaded=!0}return e.prototype.load=function(){return n.services.$q.when(this)},e}(),q=function(){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(e.length<2)throw new Error("pass at least two injectors");this.injectors=e}return e.prototype.get=function(t,r){for(var n=0;n<this.injectors.length;n++){var o=this.injectors[n].get(t,e.NOT_FOUND);if(o!==e.NOT_FOUND)return o}if(arguments.length>=2)return r;this.injectors[0].get(t)},e.NOT_FOUND={},e}(),L=0,k=function(e){return e.inputs.map(function(e){return{prop:e.propName,token:e.templateName}})},B=function(){function e(e,t,r){this.router=e,this.viewContainerRef=r,this.uiViewData={},this.parent=t}return Object.defineProperty(e.prototype,"_name",{set:function(e){this.name=e},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){var e=this,t=this.router,r=this.parent.fqn,n=this.name||"$default";this.uiViewData={$type:"ng2",id:L++,name:n,fqn:r?r+"."+n:n,creationContext:this.parent.context,configUpdated:this.viewConfigUpdated.bind(this),config:void 0},this.deregisterHook=t.transitionService.onBefore({},function(t){return e.applyUiCanExitHook(t)}),this.deregisterUIView=t.viewService.registerUIView(this.uiViewData)},e.prototype.applyUiCanExitHook=function(e){var t=this.componentRef&&this.componentRef.instance,r=t&&t.uiCanExit;if(n.isFunction(r)){var o=n.parse("uiViewData.config.viewDecl.$context.self")(this);-1!==e.exiting().indexOf(o)&&e.onStart({},function(){return r.call(t,e)})}},e.prototype.disposeLast=function(){this.componentRef&&this.componentRef.destroy(),this.componentRef=null},e.prototype.ngOnDestroy=function(){this.deregisterUIView&&this.deregisterUIView(),this.deregisterHook&&this.deregisterHook(),this.disposeLast()},e.prototype.viewConfigUpdated=function(e){if(!e)return this.disposeLast();e instanceof $&&this.uiViewData.config!==e&&(this.disposeLast(),n.trace.traceUIViewConfigUpdated(this.uiViewData,e&&e.viewDecl.$context),this.applyUpdatedConfig(e))},e.prototype.applyUpdatedConfig=function(e){this.uiViewData.config=e;var r=new n.ResolveContext(e.path),o=this.getComponentInjector(r),i=e.viewDecl.component,a=o.get(t.ComponentFactoryResolver),s=a.resolveComponentFactory(i);this.componentRef=this.componentTarget.createComponent(s,void 0,o),this.applyInputBindings(s,this.componentRef,r,i)},e.prototype.getComponentInjector=function(r){var o=r.getTokens().map(function(e){return r.getResolvable(e)}).filter(function(e){return e.resolved}),i=o.map(function(e){return{provide:e.token,useValue:e.data}}),a={context:this.uiViewData.config.viewDecl.$context,fqn:this.uiViewData.fqn};i.push({provide:e.PARENT_INJECT,useValue:a});var s=this.viewContainerRef.injector,u=r.getResolvable(n.NATIVE_INJECTOR_TOKEN).data,c=new q(u,s);return t.ReflectiveInjector.resolveAndCreate(i,c)},e.prototype.applyInputBindings=function(e,t,r,o){var i=t.instance,a=this.uiViewData.config.viewDecl.bindings||{},s=Object.keys(a),u=function(t){var r=e.inputs.find(function(e){return e.templateName===t});return r&&r.propName||t},c=s.reduce(function(e,t){return e.concat([{prop:u(t),token:a[t]}])},[]),p=k(e).filter(function(e){return!n.inArray(s,e.prop)}),f=function(e){return{prop:e.prop,resolvable:r.getResolvable(e.token)}};c.concat(p).map(f).filter(function(e){return e.resolvable&&e.resolvable.resolved}).forEach(function(e){i[e.prop]=e.resolvable.data}),t.changeDetectorRef.detectChanges()},e.PARENT_INJECT="UIView.PARENT_INJECT",e.decorators=[{type:t.Component,args:[{selector:"ui-view, [ui-view]",template:'\n <ng-template #componentTarget></ng-template>\n <ng-content *ngIf="!componentRef"></ng-content>\n '}]}],e.ctorParameters=function(){return[{type:n.UIRouter},{type:void 0,decorators:[{type:t.Inject,args:[e.PARENT_INJECT]}]},{type:t.ViewContainerRef}]},e.propDecorators={componentTarget:[{type:t.ViewChild,args:["componentTarget",{read:t.ViewContainerRef}]}],name:[{type:t.Input,args:["name"]}],_name:[{type:t.Input,args:["ui-view"]}]},e}(),H=function(){function e(e,t){this._el=e,this._renderer=t}return e.prototype.openInNewTab=function(){return"_blank"===this._el.nativeElement.target},e.prototype.update=function(e){e&&""!==e?this._renderer.setProperty(this._el.nativeElement,"href",e):this._renderer.removeAttribute(this._el.nativeElement,"href")},e.decorators=[{type:t.Directive,args:[{selector:"a[uiSref]"}]}],e.ctorParameters=function(){return[{type:t.ElementRef},{type:t.Renderer2}]},e}(),J=function(){function e(e,t,r){var n=this;this.targetState$=new o.ReplaySubject(1),this._emit=!1,this._router=e,this._anchorUISref=t,this.parent=r,this._statesSub=e.globals.states$.subscribe(function(){return n.update()})}return Object.defineProperty(e.prototype,"uiSref",{set:function(e){this.state=e,this.update()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"uiParams",{set:function(e){this.params=e,this.update()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"uiOptions",{set:function(e){this.options=e,this.update()},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){this._emit=!0,this.update()},e.prototype.ngOnDestroy=function(){this._emit=!1,this._statesSub.unsubscribe(),this.targetState$.unsubscribe()},e.prototype.update=function(){var e=this._router.stateService;if(this._emit){var t=e.target(this.state,this.params,this.getOptions());this.targetState$.next(t)}if(this._anchorUISref){var r=e.href(this.state,this.params,this.getOptions());this._anchorUISref.update(r)}},e.prototype.getOptions=function(){var e={relative:this.parent&&this.parent.context&&this.parent.context.name,inherit:!0,source:"sref"};return n.extend(e,this.options||{})},e.prototype.go=function(){if(!this._anchorUISref||!this._anchorUISref.openInNewTab())return this._router.stateService.go(this.state,this.params,this.getOptions()),!1},e.decorators=[{type:t.Directive,args:[{selector:"[uiSref]",host:{"(click)":"go()"}}]}],e.ctorParameters=function(){return[{type:n.UIRouter},{type:H,decorators:[{type:t.Optional}]},{type:void 0,decorators:[{type:t.Inject,args:[B.PARENT_INJECT]}]}]},e.propDecorators={state:[{type:t.Input,args:["uiSref"]}],params:[{type:t.Input,args:["uiParams"]}],options:[{type:t.Input,args:["uiOptions"]}]},e}(),z={active:!1,exact:!1,entering:!1,exiting:!1},K=function(e){if(!e.exists())return function(){return!1};var t=e.$state(),r=e.params(),o=n.PathUtils.buildPath(e),i=o.map(function(e){return e.paramSchema}).reduce(n.unnestR,[]).filter(function(e){return r.hasOwnProperty(e.id)});return function(e){var o=n.tail(e);if(!o||o.state!==t)return!1;var a=n.PathUtils.paramValues(e);return n.Param.equals(i,a,r)}},Y=function(){function e(e){this.uiSrefStatus=new t.EventEmitter(!1),this._globals=e,this.status=Object.assign({},z)}return e.prototype.ngAfterContentInit=function(){var e=this,t=c.switchMap.call(this._globals.start$,function(e){var t=function(t){return{evt:t,trans:e}},r=a.of(t("start")),n=e.promise.then(function(){return t("success")},function(){return t("error")}),o=s.fromPromise(n);return f.concat.call(r,o)});this._srefs$=new i.BehaviorSubject(this.srefs.toArray()),this._srefChangesSub=this.srefs.changes.subscribe(function(t){return e._srefs$.next(t)});var r=c.switchMap.call(this._srefs$,function(e){return u.combineLatest(e.map(function(e){return e.targetState$}))});this._subscription=c.switchMap.call(t,function(e){return p.map.call(r,function(t){return t.map(function(t){return y(e,t)}).reduce(m)})}).subscribe(this._setStatus.bind(this))},e.prototype.ngOnDestroy=function(){this._subscription&&this._subscription.unsubscribe(),this._srefChangesSub&&this._srefChangesSub.unsubscribe(),this._srefs$&&this._srefs$.unsubscribe(),this._subscription=this._srefChangesSub=this._srefs$=void 0},e.prototype._setStatus=function(e){this.status=e,this.uiSrefStatus.emit(e)},e.decorators=[{type:t.Directive,args:[{selector:"[uiSrefStatus],[uiSrefActive],[uiSrefActiveEq]"}]}],e.ctorParameters=function(){return[{type:n.UIRouterGlobals}]},e.propDecorators={uiSrefStatus:[{type:t.Output,args:["uiSrefStatus"]}],srefs:[{type:t.ContentChildren,args:[J,{descendants:!0}]}]},e}(),G=function(){function e(e,t,r){var n=this;this._classes=[],this._classesEq=[],this._subscription=e.uiSrefStatus.subscribe(function(e){n._classes.forEach(function(n){return t.setElementClass(r.nativeElement,n,e.active)}),n._classesEq.forEach(function(n){return t.setElementClass(r.nativeElement,n,e.exact)})})}return Object.defineProperty(e.prototype,"active",{set:function(e){this._classes=e.split("s+")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"activeEq",{set:function(e){this._classesEq=e.split("s+")},enumerable:!0,configurable:!0}),e.prototype.ngOnDestroy=function(){this._subscription.unsubscribe()},e.decorators=[{type:t.Directive,args:[{selector:"[uiSrefActive],[uiSrefActiveEq]"}]}],e.ctorParameters=function(){return[{type:Y},{type:t.Renderer},{type:t.ElementRef,decorators:[{type:t.Host}]}]},e.propDecorators={active:[{type:t.Input,args:["uiSrefActive"]}],activeEq:[{type:t.Input,args:["uiSrefActiveEq"]}]},e}(),Z=[J,H,B,G,Y],Q=Z,W=new t.OpaqueToken("UIRouter Root Module"),X=new t.OpaqueToken("UIRouter Module"),ee=new t.OpaqueToken("UIRouter States"),te=function(){function e(){}return e.forRoot=function(t){return void 0===t&&(t={}),{ngModule:e,providers:[ae,se,_(t.useHash)].concat(R(t))}},e.forChild=function(t){return void 0===t&&(t={}),{ngModule:e,providers:b(t)}},e.decorators=[{type:t.NgModule,args:[{imports:[r.CommonModule],declarations:[Z],exports:[Z],entryComponents:[B]}]}],e.ctorParameters=function(){return[]},e}(),re=function(){function e(e){function t(t,r){var n={currentStates:e.stateRegistry.get(),registered:[],deregistered:[]};t&&(n[t]=r),a.next(n)}this.name="@uirouter/rx",this.deregisterFns=[];var r=new o.ReplaySubject(1),n=r.mergeMap(function(e){return e.promise.then(function(){return e})}),i=n.map(function(e){return e.params()}),a=new o.ReplaySubject(1);this.deregisterFns.push(e.transitionService.onStart({},function(e){return r.next(e)})),this.deregisterFns.push(e.stateRegistry.onStatesChanged(t)),t(null,null),Object.assign(e.globals,{start$:r,success$:n,params$:i,states$:a})}return e.prototype.dispose=function(){this.deregisterFns.forEach(function(e){return e()}),this.deregisterFns=[]},e}(),ne=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},oe=function(e){function t(t,r,n){var o=e.call(this,t,n)||this;return o._locationStrategy=r,o._locationStrategy.onPopState(function(e){"hashchange"!==e.type&&o._listener(e)}),o}return O(t,e),t.prototype._get=function(){return this._locationStrategy.path(!0).replace(this._locationStrategy.getBaseHref().replace(/\/$/,""),"")},t.prototype._set=function(e,t,r,o){var i=n.parseUrl(r),a=i.path,s=i.search,u=i.hash,c=a+(u?"#"+u:"");o?this._locationStrategy.replaceState(e,t,c,s):this._locationStrategy.pushState(e,t,c,s)},t.prototype.dispose=function(t){e.prototype.dispose.call(this,t)},t}(n.BaseLocationServices),ie=function(e){function t(t,o){var i=e.call(this,t,n.is(r.PathLocationStrategy)(o))||this;return i._locationStrategy=o,i}return O(t,e),t.prototype.baseHref=function(e){return this._locationStrategy.getBaseHref()},t}(n.BrowserLocationConfig),ae=[{provide:n.UIRouter,useFactory:x,deps:[r.LocationStrategy,W,X,t.Injector]},{provide:B.PARENT_INJECT,useFactory:C,deps:[n.StateRegistry]}],se=[{provide:n.StateService,useFactory:T,deps:[n.UIRouter]},{provide:n.TransitionService,useFactory:j,deps:[n.UIRouter]},{provide:n.UrlMatcherFactory,useFactory:N,deps:[n.UIRouter]},{provide:n.UrlRouter,useFactory:V,deps:[n.UIRouter]},{provide:n.UrlService,useFactory:P,deps:[n.UIRouter]},{provide:n.ViewService,useFactory:D,deps:[n.UIRouter]},{provide:n.StateRegistry,useFactory:M,deps:[n.UIRouter]},{provide:n.UIRouterGlobals,useFactory:A,deps:[n.UIRouter]}],ue=ae.concat(se);e.uiRouterFactory=x,e.parentUIViewInjectFactory=C,e._UIROUTER_INSTANCE_PROVIDERS=ae,e.fnStateService=T,e.fnTransitionService=j,e.fnUrlMatcherFactory=N,e.fnUrlRouter=V,e.fnUrlService=P,e.fnViewService=D,e.fnStateRegistry=M,e.fnGlobals=A,e._UIROUTER_SERVICE_PROVIDERS=se,e.UIROUTER_PROVIDERS=ue,e.UIROUTER_ROOT_MODULE=W,e.UIROUTER_MODULE_TOKEN=X,e.UIROUTER_STATES=ee,e.makeRootProviders=R,e.makeChildProviders=b,e.locationStrategy=_,e.UIRouterModule=te,e.applyModuleConfig=d,e.applyRootModuleConfig=g,e._UIROUTER_DIRECTIVES=Z,e.UIROUTER_DIRECTIVES=Q,e.UIView=B,e.AnchorUISref=H,e.UISref=J,e.UISrefStatus=Y,e.UISrefActive=G,e.ng2ViewsBuilder=h,e.Ng2ViewConfig=$,e.ng2LazyLoadBuilder=U,e.loadNgModule=S,e.loadModuleFactory=I,e.applyNgModule=w,e.multiProviderParentChildDelta=E,Object.keys(n).forEach(function(t){e[t]=n[t]}),Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common"),require("@uirouter/core"),require("rxjs/ReplaySubject"),require("rxjs/BehaviorSubject"),require("rxjs/observable/of"),require("rxjs/observable/fromPromise"),require("rxjs/observable/combineLatest"),require("rxjs/operator/switchMap"),require("rxjs/operator/map"),require("rxjs/operator/concat"),require("@angular/router"),require("@uirouter/rx")):"function"==typeof define&&define.amd?define(["exports","@angular/core","@angular/common","@uirouter/core","rxjs/ReplaySubject","rxjs/BehaviorSubject","rxjs/observable/of","rxjs/observable/fromPromise","rxjs/observable/combineLatest","rxjs/operator/switchMap","rxjs/operator/map","rxjs/operator/concat","@angular/router","@uirouter/rx"],t):t(e["@uirouter/angular"]=e["@uirouter/angular"]||{},e.ng.core,e.ng.common,e["@uirouter/core"],e.Rx,e.Rx,e.Rx.Observable,e.Rx.Observable,e.rxjs_observable_combineLatest,e.rxjs_operator_switchMap,e.Rx.Observable.prototype,e.rxjs_operator_concat,e._angular_router,e["@uirouter/rx"])}(this,function(e,t,r,n,o,i,a,s,u,c,p,f,l,h){"use strict";function d(e){var t={},r=e.views||{$default:n.pick(e,["component","bindings"])};return n.forEach(r,function(r,o){if(o=o||"$default",n.isFunction(r)&&(r={component:r}),0!=Object.keys(r).length){r.$type="ng2",r.$context=e,r.$name=o;var i=n.ViewService.normalizeUIViewTarget(r.$context,r.$name);r.$uiViewName=i.uiViewName,r.$uiViewContextAnchor=i.uiViewContextAnchor,t[o]=r}}),t}function g(e,t,r){return void 0===r&&(r={}),n.isFunction(r.config)&&r.config(e,t,r),(r.states||[]).map(function(t){return e.stateRegistry.register(t)})}function v(e,t,r){n.isDefined(r.deferIntercept)&&e.urlService.deferIntercept(r.deferIntercept),n.isDefined(r.otherwise)&&e.urlService.rules.otherwise(r.otherwise),n.isDefined(r.initial)&&e.urlService.rules.initial(r.initial)}function _(e,t){return t.map(function(r){return e.concat(n.PathUtils.subPath(t,function(e){return e.state===r.state}))})}function y(e,t){var r=Z(t),o=e.trans.treeChanges(),i="start"===e.evt,a="success"===e.evt,s=a?o.to:o.from;return{active:function(){return _([],s).map(r).reduce(n.anyTrueR,!1)}(),exact:function(){return r(s)}(),entering:!!i&&function(){return _(o.retained,o.entering).map(r).reduce(n.anyTrueR,!1)}(),exiting:!!i&&function(){return _(o.retained,o.exiting).map(r).reduce(n.anyTrueR,!1)}(),targetStates:[t]}}function m(e,t){return{active:e.active||t.active,exact:e.exact||t.exact,entering:e.entering||t.entering,exiting:e.exiting||t.exiting,targetStates:e.targetStates.concat(t.targetStates)}}function R(e,t){var r=t[0];return r&&r.deferInitialRender?function(){return new Promise(function(t){var r=function(e){e.promise.then(t,t)};e.onStart({},r,{invokeLimit:1})})}:function(){return Promise.resolve()}}function S(e){return[{provide:te,useValue:e,multi:!0},{provide:re,useValue:e,multi:!0},{provide:l.ROUTES,useValue:e.states||[],multi:!0},{provide:t.ANALYZE_FOR_ENTRY_COMPONENTS,useValue:e.states||[],multi:!0},{provide:t.APP_INITIALIZER,useFactory:R,deps:[n.TransitionService,te],multi:!0}]}function b(e){return[{provide:re,useValue:e,multi:!0},{provide:l.ROUTES,useValue:e.states||[],multi:!0},{provide:t.ANALYZE_FOR_ENTRY_COMPONENTS,useValue:e.states||[],multi:!0}]}function I(e){return{provide:r.LocationStrategy,useClass:e?r.HashLocationStrategy:r.PathLocationStrategy}}function w(e){return function(t,r){var o=t.injector().get(n.NATIVE_INJECTOR_TOKEN),i=function(e){return e.create(o)},a=function(e){return U(t,e,o,r)};return E(e,o).then(i).then(a)}}function E(e,r){if(n.isString(e))return r.get(t.NgModuleFactoryLoader).load(e);var o=r.get(t.Compiler),i=o instanceof t.Compiler,a=function(e){return e&&e.__esModule&&e.default?e.default:e},s=function(e){return o.compileModuleAsync(e)},u=Promise.resolve(e()).then(a);return i?u:u.then(s)}function U(e,t,r,o){var i=t.injector,a=i.get(n.UIRouter),s=a.stateRegistry,u=o.name,c=s.get(u),p=/^(.*)\.\*\*$/.exec(u),f=p&&p[1],l=O(r,i,te).reduce(n.uniqR,[]),h=O(r,i,re).reduce(n.uniqR,[]);if(l.length)throw console.log(l),new Error("Lazy loaded modules should not contain a UIRouterModule.forRoot() module");var d=h.map(function(e){return g(a,i,e)}).reduce(n.unnestR,[]).reduce(n.uniqR,[]);if(p){var v=s.get(f);if(!v||v===c)throw new Error("The Future State named '"+u+"' lazy loaded an NgModule. The lazy loaded NgModule must have a state named '"+f+"' which replaces the (placeholder) '"+u+"' Future State. Add a '"+f+"' state to the lazy loaded NgModule using UIRouterModule.forChild({ states: CHILD_STATES }).")}return d.filter(function(e){return!n.inArray(d,e.parent)}).forEach(function(e){return e.resolvables.push(n.Resolvable.fromData(n.NATIVE_INJECTOR_TOKEN,i))}),{}}function O(e,t,r){var n=t.get(r,[]),o=e.get(r,[]);return n.filter(function(e){return-1===o.indexOf(e)})}function x(e,t){var r=e.loadChildren;return r?w(r):e.lazyLoad}function T(e,t){function r(){this.constructor=e}ie(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function C(e,o,i,a){if(1!==o.length)throw new Error("Exactly one UIRouterModule.forRoot() should be in the bootstrapped app module's imports: []");var s=new n.UIRouter;s.plugin(h.UIRouterRx),s.plugin(n.servicesPlugin),n.services.$injector.get=a.get.bind(a),s.locationService=new ae(s,e,r.isPlatformBrowser(a.get(t.PLATFORM_ID))),s.locationConfig=new se(s,e);var u=function(e,t){return new L(e,t)};s.viewService._pluginapi._viewConfigFactory("ng2",u);var c=s.stateRegistry;c.decorator("views",d),c.decorator("lazyLoad",x);var p=n.Resolvable.fromData(n.NATIVE_INJECTOR_TOKEN,a);return c.root().resolvables.push(p),s.urlMatcherFactory.$get(),o.forEach(function(e){return v(s,a,e)}),i.forEach(function(e){return g(s,a,e)}),s.urlRouter.interceptDeferred||(s.urlService.listen(),s.urlService.sync()),s}function j(e){return{fqn:null,context:e.root()}}function N(e){return e.stateService}function P(e){return e.transitionService}function V(e){return e.urlMatcherFactory}function D(e){return e.urlRouter}function A(e){return e.urlService}function M(e){return e.viewService}function F(e){return e.stateRegistry}function $(e){return e.globals}var q=0,L=function(){function e(e,t){this.path=e,this.viewDecl=t,this.$id=q++,this.loaded=!0}return e.prototype.load=function(){return n.services.$q.when(this)},e}(),k=function(){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(e.length<2)throw new Error("pass at least two injectors");this.injectors=e}return e.prototype.get=function(t,r){for(var n=0;n<this.injectors.length;n++){var o=this.injectors[n].get(t,e.NOT_FOUND);if(o!==e.NOT_FOUND)return o}if(arguments.length>=2)return r;this.injectors[0].get(t)},e.NOT_FOUND={},e}(),B=0,H=function(e){return e.inputs.map(function(e){return{prop:e.propName,token:e.templateName}})},J=H,z=function(){function e(e,t,r){this.router=e,this.viewContainerRef=r,this._uiViewData={},this._parent=t}return Object.defineProperty(e.prototype,"_name",{set:function(e){this.name=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"state",{get:function(){return n.parse("_uiViewData.config.viewDecl.$context.self")(this)},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){var e=this,t=this.router,r=this._parent.fqn,n=this.name||"$default";this._uiViewData={$type:"ng2",id:B++,name:n,fqn:r?r+"."+n:n,creationContext:this._parent.context,configUpdated:this._viewConfigUpdated.bind(this),config:void 0},this._deregisterHook=t.transitionService.onBefore({},function(t){return e._applyUiCanExitHook(t)}),this._deregisterUIView=t.viewService.registerUIView(this._uiViewData)},e.prototype._applyUiCanExitHook=function(e){var t=this._componentRef&&this._componentRef.instance,r=t&&t.uiCanExit;if(n.isFunction(r)){var o=this.state;-1!==e.exiting().indexOf(o)&&e.onStart({},function(){return r.call(t,e)})}},e.prototype._disposeLast=function(){this._componentRef&&this._componentRef.destroy(),this._componentRef=null},e.prototype.ngOnDestroy=function(){this._deregisterUIView&&this._deregisterUIView(),this._deregisterHook&&this._deregisterHook(),this._disposeLast()},e.prototype._viewConfigUpdated=function(e){if(!e)return this._disposeLast();e instanceof L&&this._uiViewData.config!==e&&(this._disposeLast(),n.trace.traceUIViewConfigUpdated(this._uiViewData,e&&e.viewDecl.$context),this._applyUpdatedConfig(e),this._componentRef.changeDetectorRef.markForCheck())},e.prototype._applyUpdatedConfig=function(e){this._uiViewData.config=e;var r=new n.ResolveContext(e.path),o=this._getComponentInjector(r),i=e.viewDecl.component,a=o.get(t.ComponentFactoryResolver),s=a.resolveComponentFactory(i);this._componentRef=this._componentTarget.createComponent(s,void 0,o),this._applyInputBindings(s,this._componentRef.instance,r,i)},e.prototype._getComponentInjector=function(r){var o=r.getTokens().map(function(e){return r.getResolvable(e)}).filter(function(e){return e.resolved}),i=o.map(function(e){return{provide:e.token,useValue:e.data}}),a={context:this._uiViewData.config.viewDecl.$context,fqn:this._uiViewData.fqn};i.push({provide:e.PARENT_INJECT,useValue:a});var s=this.viewContainerRef.injector,u=r.getResolvable(n.NATIVE_INJECTOR_TOKEN).data,c=new k(u,s);return t.ReflectiveInjector.resolveAndCreate(i,c)},e.prototype._applyInputBindings=function(e,t,r,o){var i=this._uiViewData.config.viewDecl.bindings||{},a=Object.keys(i),s=function(t){var r=e.inputs.find(function(e){return e.templateName===t});return r&&r.propName||t},u=a.reduce(function(e,t){return e.concat([{prop:s(t),token:i[t]}])},[]),c=H(e).filter(function(e){return!n.inArray(a,e.prop)}),p=function(e){return{prop:e.prop,resolvable:r.getResolvable(e.token)}};u.concat(c).map(p).filter(function(e){return e.resolvable&&e.resolvable.resolved}).forEach(function(e){t[e.prop]=e.resolvable.data})},e.PARENT_INJECT="UIView.PARENT_INJECT",e.decorators=[{type:t.Component,args:[{selector:"ui-view, [ui-view]",exportAs:"uiView",template:'\n <ng-template #componentTarget></ng-template>\n <ng-content *ngIf="!_componentRef"></ng-content>\n '}]}],e.ctorParameters=function(){return[{type:n.UIRouter},{type:void 0,decorators:[{type:t.Inject,args:[e.PARENT_INJECT]}]},{type:t.ViewContainerRef}]},e.propDecorators={_componentTarget:[{type:t.ViewChild,args:["componentTarget",{read:t.ViewContainerRef}]}],name:[{type:t.Input,args:["name"]}],_name:[{type:t.Input,args:["ui-view"]}]},e}(),K=function(){function e(e,t){this._el=e,this._renderer=t}return e.prototype.openInNewTab=function(){return"_blank"===this._el.nativeElement.target},e.prototype.update=function(e){e&&""!==e?this._renderer.setProperty(this._el.nativeElement,"href",e):this._renderer.removeAttribute(this._el.nativeElement,"href")},e.decorators=[{type:t.Directive,args:[{selector:"a[uiSref]"}]}],e.ctorParameters=function(){return[{type:t.ElementRef},{type:t.Renderer2}]},e}(),Y=function(){function e(e,t,r){var n=this;this.targetState$=new o.ReplaySubject(1),this._emit=!1,this._router=e,this._anchorUISref=t,this._parent=r,this._statesSub=e.globals.states$.subscribe(function(){return n.update()})}return Object.defineProperty(e.prototype,"uiSref",{set:function(e){this.state=e,this.update()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"uiParams",{set:function(e){this.params=e,this.update()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"uiOptions",{set:function(e){this.options=e,this.update()},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){this._emit=!0,this.update()},e.prototype.ngOnChanges=function(e){this.update()},e.prototype.ngOnDestroy=function(){this._emit=!1,this._statesSub.unsubscribe(),this.targetState$.unsubscribe()},e.prototype.update=function(){var e=this._router.stateService;if(this._emit){var t=e.target(this.state,this.params,this.getOptions());this.targetState$.next(t)}if(this._anchorUISref){var r=e.href(this.state,this.params,this.getOptions());this._anchorUISref.update(r)}},e.prototype.getOptions=function(){var e={relative:this._parent&&this._parent.context&&this._parent.context.name,inherit:!0,source:"sref"};return n.extend(e,this.options||{})},e.prototype.go=function(){if(!this._anchorUISref||!this._anchorUISref.openInNewTab())return this._router.stateService.go(this.state,this.params,this.getOptions()),!1},e.decorators=[{type:t.Directive,args:[{selector:"[uiSref]",exportAs:"uiSref",host:{"(click)":"go()"}}]}],e.ctorParameters=function(){return[{type:n.UIRouter},{type:K,decorators:[{type:t.Optional}]},{type:void 0,decorators:[{type:t.Inject,args:[z.PARENT_INJECT]}]}]},e.propDecorators={state:[{type:t.Input,args:["uiSref"]}],params:[{type:t.Input,args:["uiParams"]}],options:[{type:t.Input,args:["uiOptions"]}]},e}(),G={active:!1,exact:!1,entering:!1,exiting:!1,targetStates:[]},Z=function(e){if(!e.exists())return function(){return!1};var t=e.$state(),r=e.params(),o=n.PathUtils.buildPath(e),i=o.map(function(e){return e.paramSchema}).reduce(n.unnestR,[]).filter(function(e){return r.hasOwnProperty(e.id)});return function(e){var o=n.tail(e);if(!o||o.state!==t)return!1;var a=n.PathUtils.paramValues(e);return n.Param.equals(i,a,r)}},Q=function(){function e(e){this.uiSrefStatus=new t.EventEmitter(!1),this._globals=e,this.status=Object.assign({},G)}return e.prototype.ngAfterContentInit=function(){var e=this,t=c.switchMap.call(this._globals.start$,function(e){var t=function(t){return{evt:t,trans:e}},r=a.of(t("start")),n=e.promise.then(function(){return t("success")},function(){return t("error")}),o=s.fromPromise(n);return f.concat.call(r,o)});this._srefs$=new i.BehaviorSubject(this._srefs.toArray()),this._srefChangesSub=this._srefs.changes.subscribe(function(t){return e._srefs$.next(t)});var r=c.switchMap.call(this._srefs$,function(e){return u.combineLatest(e.map(function(e){return e.targetState$}))});this._subscription=c.switchMap.call(t,function(e){return p.map.call(r,function(t){return t.map(function(t){return y(e,t)}).reduce(m)})}).subscribe(this._setStatus.bind(this))},e.prototype.ngOnDestroy=function(){this._subscription&&this._subscription.unsubscribe(),this._srefChangesSub&&this._srefChangesSub.unsubscribe(),this._srefs$&&this._srefs$.unsubscribe(),this._subscription=this._srefChangesSub=this._srefs$=void 0},e.prototype._setStatus=function(e){this.status=e,this.uiSrefStatus.emit(e)},e.decorators=[{type:t.Directive,args:[{selector:"[uiSrefStatus],[uiSrefActive],[uiSrefActiveEq]",exportAs:"uiSrefStatus"}]}],e.ctorParameters=function(){return[{type:n.UIRouterGlobals}]},e.propDecorators={uiSrefStatus:[{type:t.Output,args:["uiSrefStatus"]}],_srefs:[{type:t.ContentChildren,args:[Y,{descendants:!0}]}]},e}(),W=function(){function e(e,t,r){var n=this;this._classes=[],this._classesEq=[],this._subscription=e.uiSrefStatus.subscribe(function(e){n._classes.forEach(function(n){return t.setElementClass(r.nativeElement,n,e.active)}),n._classesEq.forEach(function(n){return t.setElementClass(r.nativeElement,n,e.exact)})})}return Object.defineProperty(e.prototype,"active",{set:function(e){this._classes=e.split("s+")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"activeEq",{set:function(e){this._classesEq=e.split("s+")},enumerable:!0,configurable:!0}),e.prototype.ngOnDestroy=function(){this._subscription.unsubscribe()},e.decorators=[{type:t.Directive,args:[{selector:"[uiSrefActive],[uiSrefActiveEq]"}]}],e.ctorParameters=function(){return[{type:Q},{type:t.Renderer},{type:t.ElementRef,decorators:[{type:t.Host}]}]},e.propDecorators={active:[{type:t.Input,args:["uiSrefActive"]}],activeEq:[{type:t.Input,args:["uiSrefActiveEq"]}]},e}(),X=[Y,K,z,W,Q],ee=X,te=new t.InjectionToken("UIRouter Root Module"),re=new t.InjectionToken("UIRouter Module"),ne=new t.InjectionToken("UIRouter States"),oe=function(){function e(){}return e.forRoot=function(t){return void 0===t&&(t={}),{ngModule:e,providers:[ue,ce,I(t.useHash)].concat(S(t))}},e.forChild=function(t){return void 0===t&&(t={}),{ngModule:e,providers:b(t)}},e.decorators=[{type:t.NgModule,args:[{imports:[r.CommonModule],declarations:[X],exports:[X],entryComponents:[z]}]}],e.ctorParameters=function(){return[]},e}(),ie=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},ae=function(e){function t(t,r,n){var o=e.call(this,t,n)||this;return o._locationStrategy=r,o._locationStrategy.onPopState(function(e){"hashchange"!==e.type&&o._listener(e)}),o}return T(t,e),t.prototype._get=function(){return this._locationStrategy.path(!0).replace(this._locationStrategy.getBaseHref().replace(/\/$/,""),"")},t.prototype._set=function(e,t,r,o){var i=n.parseUrl(r),a=i.path,s=i.search,u=i.hash,c=a+(u?"#"+u:"");o?this._locationStrategy.replaceState(e,t,c,s):this._locationStrategy.pushState(e,t,c,s)},t.prototype.dispose=function(t){e.prototype.dispose.call(this,t)},t}(n.BaseLocationServices),se=function(e){function t(t,o){var i=e.call(this,t,n.is(r.PathLocationStrategy)(o))||this;return i._locationStrategy=o,i}return T(t,e),t.prototype.baseHref=function(e){return this._locationStrategy.getBaseHref()},t}(n.BrowserLocationConfig),ue=[{provide:n.UIRouter,useFactory:C,deps:[r.LocationStrategy,te,re,t.Injector]},{provide:z.PARENT_INJECT,useFactory:j,deps:[n.StateRegistry]}],ce=[{provide:n.StateService,useFactory:N,deps:[n.UIRouter]},{provide:n.TransitionService,useFactory:P,deps:[n.UIRouter]},{provide:n.UrlMatcherFactory,useFactory:V,deps:[n.UIRouter]},{provide:n.UrlRouter,useFactory:D,deps:[n.UIRouter]},{provide:n.UrlService,useFactory:A,deps:[n.UIRouter]},{provide:n.ViewService,useFactory:M,deps:[n.UIRouter]},{provide:n.StateRegistry,useFactory:F,deps:[n.UIRouter]},{provide:n.UIRouterGlobals,useFactory:$,deps:[n.UIRouter]}],pe=ue.concat(ce);e.uiRouterFactory=C,e.parentUIViewInjectFactory=j,e._UIROUTER_INSTANCE_PROVIDERS=ue,e.fnStateService=N,e.fnTransitionService=P,e.fnUrlMatcherFactory=V,e.fnUrlRouter=D,e.fnUrlService=A,e.fnViewService=M,e.fnStateRegistry=F,e.fnGlobals=$,e._UIROUTER_SERVICE_PROVIDERS=ce,e.UIROUTER_PROVIDERS=pe,e.UIROUTER_ROOT_MODULE=te,e.UIROUTER_MODULE_TOKEN=re,e.UIROUTER_STATES=ne,e.onTransitionReady=R,e.makeRootProviders=S,e.makeChildProviders=b,e.locationStrategy=I,e.UIRouterModule=oe,e.applyModuleConfig=g,e.applyRootModuleConfig=v,e._UIROUTER_DIRECTIVES=X,e.UIROUTER_DIRECTIVES=ee,e.UIView=z,e.ɵ0=J,e.AnchorUISref=K,e.UISref=Y,e.UISrefStatus=Q,e.UISrefActive=W,e.ng2ViewsBuilder=d,e.Ng2ViewConfig=L,e.ng2LazyLoadBuilder=x,e.loadNgModule=w,e.loadModuleFactory=E,e.applyNgModule=U,e.multiProviderParentChildDelta=O,Object.keys(n).forEach(function(t){e[t]=n[t]}),Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=ui-router-ng2.min.js.map |
@@ -1,1 +0,1 @@ | ||
[{"__symbolic":"module","version":3,"metadata":{"_UIROUTER_DIRECTIVES":[{"__symbolic":"reference","module":"./uiSref","name":"UISref"},{"__symbolic":"reference","module":"./uiSref","name":"AnchorUISref"},{"__symbolic":"reference","module":"./uiView","name":"UIView"},{"__symbolic":"reference","module":"./uiSrefActive","name":"UISrefActive"},{"__symbolic":"reference","module":"./uiSrefStatus","name":"UISrefStatus"}],"UIROUTER_DIRECTIVES":{"__symbolic":"reference","name":"_UIROUTER_DIRECTIVES"}},"exports":[{"from":"./uiView"},{"from":"./uiSref"},{"from":"./uiSrefStatus"},{"from":"./uiSrefActive"}]},{"__symbolic":"module","version":1,"metadata":{"_UIROUTER_DIRECTIVES":[{"__symbolic":"reference","module":"./uiSref","name":"UISref"},{"__symbolic":"reference","module":"./uiSref","name":"AnchorUISref"},{"__symbolic":"reference","module":"./uiView","name":"UIView"},{"__symbolic":"reference","module":"./uiSrefActive","name":"UISrefActive"},{"__symbolic":"reference","module":"./uiSrefStatus","name":"UISrefStatus"}],"UIROUTER_DIRECTIVES":{"__symbolic":"reference","name":"_UIROUTER_DIRECTIVES"}},"exports":[{"from":"./uiView"},{"from":"./uiSref"},{"from":"./uiSrefStatus"},{"from":"./uiSrefActive"}]}] | ||
[{"__symbolic":"module","version":4,"metadata":{"_UIROUTER_DIRECTIVES":[{"__symbolic":"reference","module":"./uiSref","name":"UISref"},{"__symbolic":"reference","module":"./uiSref","name":"AnchorUISref"},{"__symbolic":"reference","module":"./uiView","name":"UIView"},{"__symbolic":"reference","module":"./uiSrefActive","name":"UISrefActive"},{"__symbolic":"reference","module":"./uiSrefStatus","name":"UISrefStatus"}],"UIROUTER_DIRECTIVES":{"__symbolic":"reference","name":"_UIROUTER_DIRECTIVES"}},"exports":[{"from":"./uiView"},{"from":"./uiSref"},{"from":"./uiSrefStatus"},{"from":"./uiSrefActive"}]}] |
/** @ng2api @module directives */ | ||
/** */ | ||
import { UIRouter, Obj, TransitionOptions, TargetState } from "@uirouter/core"; | ||
import { ElementRef, Renderer2 } from "@angular/core"; | ||
import { ElementRef, Renderer2, OnChanges, SimpleChanges } from "@angular/core"; | ||
import { ParentUIViewInject } from "./uiView"; | ||
@@ -59,3 +59,3 @@ import { ReplaySubject } from "rxjs/ReplaySubject"; | ||
*/ | ||
export declare class UISref { | ||
export declare class UISref implements OnChanges { | ||
/** | ||
@@ -94,3 +94,3 @@ * `@Input('uiSref')` The name of the state to link to | ||
/** @internalapi */ private _anchorUISref; | ||
/** @internalapi */ parent: ParentUIViewInject; | ||
/** @internalapi */ private _parent; | ||
constructor(_router: UIRouter, _anchorUISref: AnchorUISref, parent: ParentUIViewInject); | ||
@@ -104,4 +104,5 @@ /** @internalapi */ | ||
ngOnInit(): void; | ||
ngOnChanges(changes: SimpleChanges): void; | ||
ngOnDestroy(): void; | ||
update(): void; | ||
private update(); | ||
getOptions(): TransitionOptions; | ||
@@ -108,0 +109,0 @@ /** When triggered by a (click) event, this function transitions to the UISref's target state */ |
@@ -83,5 +83,5 @@ /** @ng2api @module directives */ | ||
/** | ||
* An observable (ReplaySubject) of the state this UISref is targeting. | ||
* When the UISref is clicked, it will transition to this [[TargetState]]. | ||
*/ | ||
* An observable (ReplaySubject) of the state this UISref is targeting. | ||
* When the UISref is clicked, it will transition to this [[TargetState]]. | ||
*/ | ||
this.targetState$ = new ReplaySubject(1); | ||
@@ -91,3 +91,3 @@ /** @internalapi */ this._emit = false; | ||
this._anchorUISref = _anchorUISref; | ||
this.parent = parent; | ||
this._parent = parent; | ||
this._statesSub = _router.globals.states$.subscribe(function () { return _this.update(); }); | ||
@@ -97,3 +97,4 @@ } | ||
/** @internalapi */ | ||
set: function (val) { this.state = val; this.update(); }, | ||
set: /** @internalapi */ | ||
function (val) { this.state = val; this.update(); }, | ||
enumerable: true, | ||
@@ -104,3 +105,4 @@ configurable: true | ||
/** @internalapi */ | ||
set: function (val) { this.params = val; this.update(); }, | ||
set: /** @internalapi */ | ||
function (val) { this.params = val; this.update(); }, | ||
enumerable: true, | ||
@@ -111,3 +113,4 @@ configurable: true | ||
/** @internalapi */ | ||
set: function (val) { this.options = val; this.update(); }, | ||
set: /** @internalapi */ | ||
function (val) { this.options = val; this.update(); }, | ||
enumerable: true, | ||
@@ -120,2 +123,5 @@ configurable: true | ||
}; | ||
UISref.prototype.ngOnChanges = function (changes) { | ||
this.update(); | ||
}; | ||
UISref.prototype.ngOnDestroy = function () { | ||
@@ -139,3 +145,3 @@ this._emit = false; | ||
var defaultOpts = { | ||
relative: this.parent && this.parent.context && this.parent.context.name, | ||
relative: this._parent && this._parent.context && this._parent.context.name, | ||
inherit: true, | ||
@@ -147,3 +153,5 @@ source: "sref" | ||
/** When triggered by a (click) event, this function transitions to the UISref's target state */ | ||
UISref.prototype.go = function () { | ||
/** When triggered by a (click) event, this function transitions to the UISref's target state */ | ||
UISref.prototype.go = /** When triggered by a (click) event, this function transitions to the UISref's target state */ | ||
function () { | ||
if (this._anchorUISref && this._anchorUISref.openInNewTab()) { | ||
@@ -158,2 +166,3 @@ return; | ||
selector: '[uiSref]', | ||
exportAs: 'uiSref', | ||
host: { '(click)': 'go()' } | ||
@@ -169,5 +178,5 @@ },] }, | ||
UISref.propDecorators = { | ||
'state': [{ type: Input, args: ['uiSref',] },], | ||
'params': [{ type: Input, args: ['uiParams',] },], | ||
'options': [{ type: Input, args: ['uiOptions',] },], | ||
"state": [{ type: Input, args: ['uiSref',] },], | ||
"params": [{ type: Input, args: ['uiParams',] },], | ||
"options": [{ type: Input, args: ['uiOptions',] },], | ||
}; | ||
@@ -174,0 +183,0 @@ return UISref; |
@@ -1,1 +0,1 @@ | ||
[{"__symbolic":"module","version":3,"metadata":{"AnchorUISref":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"a[uiSref]"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef"},{"__symbolic":"reference","module":"@angular/core","name":"Renderer2"}]}],"openInNewTab":[{"__symbolic":"method"}],"update":[{"__symbolic":"method"}]}},"UISref":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[uiSref]","host":{"(click)":"go()","$quoted$":["(click)"]}}]}],"members":{"state":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["uiSref"]}]}],"params":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["uiParams"]}]}],"options":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["uiOptions"]}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"select","expression":{"__symbolic":"reference","module":"./uiView","name":"UIView"},"member":"PARENT_INJECT"}]}]],"parameters":[{"__symbolic":"reference","module":"@uirouter/core","name":"UIRouter"},{"__symbolic":"reference","name":"AnchorUISref"},{"__symbolic":"reference","module":"./uiView","name":"ParentUIViewInject"}]}],"ngOnInit":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"update":[{"__symbolic":"method"}],"getOptions":[{"__symbolic":"method"}],"go":[{"__symbolic":"method"}]}}}},{"__symbolic":"module","version":1,"metadata":{"AnchorUISref":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"a[uiSref]"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef"},{"__symbolic":"reference","module":"@angular/core","name":"Renderer2"}]}],"openInNewTab":[{"__symbolic":"method"}],"update":[{"__symbolic":"method"}]}},"UISref":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[uiSref]","host":{"(click)":"go()"}}]}],"members":{"state":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["uiSref"]}]}],"params":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["uiParams"]}]}],"options":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["uiOptions"]}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"select","expression":{"__symbolic":"reference","module":"./uiView","name":"UIView"},"member":"PARENT_INJECT"}]}]],"parameters":[{"__symbolic":"reference","module":"@uirouter/core","name":"UIRouter"},{"__symbolic":"reference","name":"AnchorUISref"},{"__symbolic":"reference","module":"./uiView","name":"ParentUIViewInject"}]}],"ngOnInit":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"update":[{"__symbolic":"method"}],"getOptions":[{"__symbolic":"method"}],"go":[{"__symbolic":"method"}]}}}}] | ||
[{"__symbolic":"module","version":4,"metadata":{"AnchorUISref":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"a[uiSref]"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef"},{"__symbolic":"reference","module":"@angular/core","name":"Renderer2"}]}],"openInNewTab":[{"__symbolic":"method"}],"update":[{"__symbolic":"method"}]}},"UISref":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[uiSref]","exportAs":"uiSref","host":{"(click)":"go()","$quoted$":["(click)"]}}]}],"members":{"state":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["uiSref"]}]}],"params":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["uiParams"]}]}],"options":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["uiOptions"]}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"select","expression":{"__symbolic":"reference","module":"./uiView","name":"UIView"},"member":"PARENT_INJECT"}]}]],"parameters":[{"__symbolic":"reference","module":"@uirouter/core","name":"UIRouter"},{"__symbolic":"reference","name":"AnchorUISref"},{"__symbolic":"reference","module":"./uiView","name":"ParentUIViewInject"}]}],"ngOnInit":[{"__symbolic":"method"}],"ngOnChanges":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"update":[{"__symbolic":"method"}],"getOptions":[{"__symbolic":"method"}],"go":[{"__symbolic":"method"}]}}}}] |
@@ -119,4 +119,4 @@ /** @ng2api @module directives */ /** */ | ||
UISrefActive.propDecorators = { | ||
'active': [{ type: Input, args: ['uiSrefActive',] },], | ||
'activeEq': [{ type: Input, args: ['uiSrefActiveEq',] },], | ||
"active": [{ type: Input, args: ['uiSrefActive',] },], | ||
"activeEq": [{ type: Input, args: ['uiSrefActiveEq',] },], | ||
}; | ||
@@ -123,0 +123,0 @@ return UISrefActive; |
@@ -1,1 +0,1 @@ | ||
[{"__symbolic":"module","version":3,"metadata":{"UISrefActive":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[uiSrefActive],[uiSrefActiveEq]"}]}],"members":{"active":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["uiSrefActive"]}]}],"activeEq":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["uiSrefActiveEq"]}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[null,null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Host"}}]],"parameters":[{"__symbolic":"reference","module":"./uiSrefStatus","name":"UISrefStatus"},{"__symbolic":"reference","module":"@angular/core","name":"Renderer"},{"__symbolic":"reference","module":"@angular/core","name":"ElementRef"}]}],"ngOnDestroy":[{"__symbolic":"method"}]}}}},{"__symbolic":"module","version":1,"metadata":{"UISrefActive":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[uiSrefActive],[uiSrefActiveEq]"}]}],"members":{"active":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["uiSrefActive"]}]}],"activeEq":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["uiSrefActiveEq"]}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[null,null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Host"}}]],"parameters":[{"__symbolic":"reference","module":"./uiSrefStatus","name":"UISrefStatus"},{"__symbolic":"reference","module":"@angular/core","name":"Renderer"},{"__symbolic":"reference","module":"@angular/core","name":"ElementRef"}]}],"ngOnDestroy":[{"__symbolic":"method"}]}}}}] | ||
[{"__symbolic":"module","version":4,"metadata":{"UISrefActive":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[uiSrefActive],[uiSrefActiveEq]"}]}],"members":{"active":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["uiSrefActive"]}]}],"activeEq":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["uiSrefActiveEq"]}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[null,null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Host"}}]],"parameters":[{"__symbolic":"reference","module":"./uiSrefStatus","name":"UISrefStatus"},{"__symbolic":"reference","module":"@angular/core","name":"Renderer"},{"__symbolic":"reference","module":"@angular/core","name":"ElementRef"}]}],"ngOnDestroy":[{"__symbolic":"method"}]}}}}] |
/** @ng2api @module directives */ | ||
/** */ | ||
import { EventEmitter, QueryList } from '@angular/core'; | ||
import { UISref } from './uiSref'; | ||
import { UIRouterGlobals } from '@uirouter/core'; | ||
import { EventEmitter } from '@angular/core'; | ||
import { TargetState, UIRouterGlobals } from '@uirouter/core'; | ||
/** | ||
@@ -18,2 +17,4 @@ * UISref status emitted from [[UISrefStatus]] | ||
exiting: boolean; | ||
/** The enclosed sref(s) target state(s) */ | ||
targetStates: TargetState[]; | ||
} | ||
@@ -42,3 +43,3 @@ /** | ||
* The `uiSrefStatus` event is emitted whenever an enclosed `uiSref`'s status changes. | ||
* The event emitted is of type [[SrefStatus]], and has boolean values for `active`, `exact`, `entering`, and `exiting`. | ||
* The event emitted is of type [[SrefStatus]], and has boolean values for `active`, `exact`, `entering`, and `exiting`; also has a [[StateOrName]] `identifier`value. | ||
* | ||
@@ -73,3 +74,3 @@ * The values from this event can be captured and stored on a component (then applied, e.g., using ngClass). | ||
/** Monitor all child components for UISref(s) */ | ||
srefs: QueryList<UISref>; | ||
private _srefs; | ||
/** The current status */ | ||
@@ -76,0 +77,0 @@ status: SrefStatus; |
/** @ng2api @module directives */ | ||
/** */ | ||
import { Directive, Output, EventEmitter, ContentChildren } from '@angular/core'; | ||
import { Directive, Output, EventEmitter, ContentChildren, QueryList } from '@angular/core'; | ||
import { UISref } from './uiSref'; | ||
@@ -18,3 +18,4 @@ import { anyTrueR, tail, unnestR, UIRouterGlobals, Param, PathUtils } from '@uirouter/core'; | ||
entering: false, | ||
exiting: false | ||
exiting: false, | ||
targetStates: [], | ||
}; | ||
@@ -46,2 +47,3 @@ /** | ||
}; | ||
var ɵ0 = pathMatches; | ||
/** | ||
@@ -94,2 +96,3 @@ * Given basePath: [a, b], appendPath: [c, d]), | ||
exiting: isStartEvent ? isExiting() : false, | ||
targetStates: [srefTarget], | ||
}; | ||
@@ -104,2 +107,3 @@ } | ||
exiting: left.exiting || right.exiting, | ||
targetStates: left.targetStates.concat(right.targetStates), | ||
}; | ||
@@ -129,3 +133,3 @@ } | ||
* The `uiSrefStatus` event is emitted whenever an enclosed `uiSref`'s status changes. | ||
* The event emitted is of type [[SrefStatus]], and has boolean values for `active`, `exact`, `entering`, and `exiting`. | ||
* The event emitted is of type [[SrefStatus]], and has boolean values for `active`, `exact`, `entering`, and `exiting`; also has a [[StateOrName]] `identifier`value. | ||
* | ||
@@ -176,4 +180,4 @@ * The values from this event can be captured and stored on a component (then applied, e.g., using ngClass). | ||
// let srefs$: Observable<UISref[]> = of(this.srefs.toArray()).concat(this.srefs.changes); | ||
this._srefs$ = new BehaviorSubject(this.srefs.toArray()); | ||
this._srefChangesSub = this.srefs.changes.subscribe(function (srefs) { return _this._srefs$.next(srefs); }); | ||
this._srefs$ = new BehaviorSubject(this._srefs.toArray()); | ||
this._srefChangesSub = this._srefs.changes.subscribe(function (srefs) { return _this._srefs$.next(srefs); }); | ||
var targetStates$ = switchMap.call(this._srefs$, function (srefs) { | ||
@@ -205,3 +209,6 @@ return combineLatest(srefs.map(function (sref) { return sref.targetState$; })); | ||
UISrefStatus.decorators = [ | ||
{ type: Directive, args: [{ selector: '[uiSrefStatus],[uiSrefActive],[uiSrefActiveEq]' },] }, | ||
{ type: Directive, args: [{ | ||
selector: '[uiSrefStatus],[uiSrefActive],[uiSrefActiveEq]', | ||
exportAs: 'uiSrefStatus' | ||
},] }, | ||
]; | ||
@@ -213,4 +220,4 @@ /** @nocollapse */ | ||
UISrefStatus.propDecorators = { | ||
'uiSrefStatus': [{ type: Output, args: ["uiSrefStatus",] },], | ||
'srefs': [{ type: ContentChildren, args: [UISref, { descendants: true },] },], | ||
"uiSrefStatus": [{ type: Output, args: ["uiSrefStatus",] },], | ||
"_srefs": [{ type: ContentChildren, args: [UISref, { descendants: true },] },], | ||
}; | ||
@@ -220,2 +227,3 @@ return UISrefStatus; | ||
export { UISrefStatus }; | ||
export { ɵ0 }; | ||
//# sourceMappingURL=uiSrefStatus.js.map |
@@ -1,1 +0,1 @@ | ||
[{"__symbolic":"module","version":3,"metadata":{"SrefStatus":{"__symbolic":"interface"},"UISrefStatus":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[uiSrefStatus],[uiSrefActive],[uiSrefActiveEq]"}]}],"members":{"uiSrefStatus":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"},"arguments":["uiSrefStatus"]}]}],"srefs":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ContentChildren"},"arguments":[{"__symbolic":"reference","module":"./uiSref","name":"UISref"},{"descendants":true}]}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@uirouter/core","name":"UIRouterGlobals"}]}],"ngAfterContentInit":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"_setStatus":[{"__symbolic":"method"}]}}}},{"__symbolic":"module","version":1,"metadata":{"SrefStatus":{"__symbolic":"interface"},"UISrefStatus":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[uiSrefStatus],[uiSrefActive],[uiSrefActiveEq]"}]}],"members":{"uiSrefStatus":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"},"arguments":["uiSrefStatus"]}]}],"srefs":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ContentChildren"},"arguments":[{"__symbolic":"reference","module":"./uiSref","name":"UISref"},{"descendants":true}]}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@uirouter/core","name":"UIRouterGlobals"}]}],"ngAfterContentInit":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"_setStatus":[{"__symbolic":"method"}]}}}}] | ||
[{"__symbolic":"module","version":4,"metadata":{"SrefStatus":{"__symbolic":"interface"},"ɵ0":{"__symbolic":"error","message":"Function call not supported","line":55,"character":20},"UISrefStatus":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[uiSrefStatus],[uiSrefActive],[uiSrefActiveEq]","exportAs":"uiSrefStatus"}]}],"members":{"uiSrefStatus":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"},"arguments":["uiSrefStatus"]}]}],"_srefs":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ContentChildren"},"arguments":[{"__symbolic":"reference","module":"./uiSref","name":"UISref"},{"descendants":true}]}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@uirouter/core","name":"UIRouterGlobals"}]}],"ngAfterContentInit":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"_setStatus":[{"__symbolic":"method"}]}}}}] |
/** @ng2api @module directives */ | ||
/** */ | ||
import { ViewContainerRef, ComponentRef, Injector, ComponentFactory } from '@angular/core'; | ||
import { UIRouter, Transition, ViewContext, ViewConfig, ActiveUIView, ResolveContext } from '@uirouter/core'; | ||
import { Ng2ViewConfig } from '../statebuilders/views'; | ||
import { ViewContainerRef, ComponentRef } from '@angular/core'; | ||
import { UIRouter, StateDeclaration, ViewContext, ViewConfig } from '@uirouter/core'; | ||
/** @internalapi These are provide()d as the string UIView.PARENT_INJECT */ | ||
@@ -60,16 +59,20 @@ export interface ParentUIViewInject { | ||
viewContainerRef: ViewContainerRef; | ||
componentTarget: ViewContainerRef; | ||
_componentTarget: ViewContainerRef; | ||
name: string; | ||
_name: string; | ||
/** The reference to the component currently inside the viewport */ | ||
componentRef: ComponentRef<any>; | ||
_componentRef: ComponentRef<any>; | ||
/** Deregisters the ui-view from the view service */ | ||
deregisterUIView: Function; | ||
private _deregisterUIView; | ||
/** Deregisters the master uiCanExit transition hook */ | ||
deregisterHook: Function; | ||
private _deregisterHook; | ||
/** Data about the this UIView */ | ||
uiViewData: ActiveUIView; | ||
parent: ParentUIViewInject; | ||
private _uiViewData; | ||
private _parent; | ||
static PARENT_INJECT: string; | ||
constructor(router: UIRouter, parent: any, viewContainerRef: ViewContainerRef); | ||
/** | ||
* @returns the UI-Router `state` that is filling this uiView, or `undefined`. | ||
*/ | ||
readonly state: StateDeclaration; | ||
ngOnInit(): void; | ||
@@ -84,4 +87,4 @@ /** | ||
*/ | ||
applyUiCanExitHook(trans: Transition): void; | ||
disposeLast(): void; | ||
private _applyUiCanExitHook(trans); | ||
private _disposeLast(); | ||
ngOnDestroy(): void; | ||
@@ -92,4 +95,4 @@ /** | ||
*/ | ||
viewConfigUpdated(config: ViewConfig): void; | ||
applyUpdatedConfig(config: Ng2ViewConfig): void; | ||
_viewConfigUpdated(config: ViewConfig): void; | ||
private _applyUpdatedConfig(config); | ||
/** | ||
@@ -105,3 +108,3 @@ * Creates a new Injector for a routed component. | ||
*/ | ||
getComponentInjector(context: ResolveContext): Injector; | ||
private _getComponentInjector(context); | ||
/** | ||
@@ -113,3 +116,3 @@ * Supplies component inputs with resolve data | ||
*/ | ||
applyInputBindings(factory: ComponentFactory<any>, ref: ComponentRef<any>, context: ResolveContext, componentClass: any): void; | ||
private _applyInputBindings(factory, component, context, componentClass); | ||
} |
@@ -20,2 +20,3 @@ /** @ng2api @module directives */ | ||
}; | ||
var ɵ0 = ng2ComponentInputs; | ||
/** | ||
@@ -72,4 +73,4 @@ * A UI-Router viewport directive, which is filled in by a view (component) on a state. | ||
/** Data about the this UIView */ | ||
this.uiViewData = {}; | ||
this.parent = parent; | ||
this._uiViewData = {}; | ||
this._parent = parent; | ||
} | ||
@@ -81,8 +82,21 @@ Object.defineProperty(UIView.prototype, "_name", { | ||
}); | ||
Object.defineProperty(UIView.prototype, "state", { | ||
/** | ||
* @returns the UI-Router `state` that is filling this uiView, or `undefined`. | ||
*/ | ||
get: /** | ||
* @returns the UI-Router `state` that is filling this uiView, or `undefined`. | ||
*/ | ||
function () { | ||
return parse("_uiViewData.config.viewDecl.$context.self")(this); | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
UIView.prototype.ngOnInit = function () { | ||
var _this = this; | ||
var router = this.router; | ||
var parentFqn = this.parent.fqn; | ||
var parentFqn = this._parent.fqn; | ||
var name = this.name || '$default'; | ||
this.uiViewData = { | ||
this._uiViewData = { | ||
$type: 'ng2', | ||
@@ -92,8 +106,8 @@ id: id++, | ||
fqn: parentFqn ? parentFqn + "." + name : name, | ||
creationContext: this.parent.context, | ||
configUpdated: this.viewConfigUpdated.bind(this), | ||
creationContext: this._parent.context, | ||
configUpdated: this._viewConfigUpdated.bind(this), | ||
config: undefined | ||
}; | ||
this.deregisterHook = router.transitionService.onBefore({}, function (trans) { return _this.applyUiCanExitHook(trans); }); | ||
this.deregisterUIView = router.viewService.registerUIView(this.uiViewData); | ||
this._deregisterHook = router.transitionService.onBefore({}, function (trans) { return _this._applyUiCanExitHook(trans); }); | ||
this._deregisterUIView = router.viewService.registerUIView(this._uiViewData); | ||
}; | ||
@@ -108,7 +122,23 @@ /** | ||
*/ | ||
UIView.prototype.applyUiCanExitHook = function (trans) { | ||
var instance = this.componentRef && this.componentRef.instance; | ||
/** | ||
* For each transition, checks the component loaded in the ui-view for: | ||
* | ||
* - has a uiCanExit() component hook | ||
* - is being exited | ||
* | ||
* If both are true, adds the uiCanExit component function as a hook to that singular Transition. | ||
*/ | ||
UIView.prototype._applyUiCanExitHook = /** | ||
* For each transition, checks the component loaded in the ui-view for: | ||
* | ||
* - has a uiCanExit() component hook | ||
* - is being exited | ||
* | ||
* If both are true, adds the uiCanExit component function as a hook to that singular Transition. | ||
*/ | ||
function (trans) { | ||
var instance = this._componentRef && this._componentRef.instance; | ||
var uiCanExitFn = instance && instance.uiCanExit; | ||
if (isFunction(uiCanExitFn)) { | ||
var state = parse("uiViewData.config.viewDecl.$context.self")(this); | ||
var state = this.state; | ||
if (trans.exiting().indexOf(state) !== -1) { | ||
@@ -121,13 +151,13 @@ trans.onStart({}, function () { | ||
}; | ||
UIView.prototype.disposeLast = function () { | ||
if (this.componentRef) | ||
this.componentRef.destroy(); | ||
this.componentRef = null; | ||
UIView.prototype._disposeLast = function () { | ||
if (this._componentRef) | ||
this._componentRef.destroy(); | ||
this._componentRef = null; | ||
}; | ||
UIView.prototype.ngOnDestroy = function () { | ||
if (this.deregisterUIView) | ||
this.deregisterUIView(); | ||
if (this.deregisterHook) | ||
this.deregisterHook(); | ||
this.disposeLast(); | ||
if (this._deregisterUIView) | ||
this._deregisterUIView(); | ||
if (this._deregisterHook) | ||
this._deregisterHook(); | ||
this._disposeLast(); | ||
}; | ||
@@ -138,7 +168,15 @@ /** | ||
*/ | ||
UIView.prototype.viewConfigUpdated = function (config) { | ||
/** | ||
* The view service is informing us of an updated ViewConfig | ||
* (usually because a transition activated some state and its views) | ||
*/ | ||
UIView.prototype._viewConfigUpdated = /** | ||
* The view service is informing us of an updated ViewConfig | ||
* (usually because a transition activated some state and its views) | ||
*/ | ||
function (config) { | ||
// The config may be undefined if there is nothing currently targeting this UIView. | ||
// Dispose the current component, if there is one | ||
if (!config) | ||
return this.disposeLast(); | ||
return this._disposeLast(); | ||
// Only care about Ng2 configs | ||
@@ -148,14 +186,16 @@ if (!(config instanceof Ng2ViewConfig)) | ||
// The "new" viewconfig is already applied, so exit early | ||
if (this.uiViewData.config === config) | ||
if (this._uiViewData.config === config) | ||
return; | ||
// This is a new ViewConfig. Dispose the previous component | ||
this.disposeLast(); | ||
trace.traceUIViewConfigUpdated(this.uiViewData, config && config.viewDecl.$context); | ||
this.applyUpdatedConfig(config); | ||
this._disposeLast(); | ||
trace.traceUIViewConfigUpdated(this._uiViewData, config && config.viewDecl.$context); | ||
this._applyUpdatedConfig(config); | ||
// Initiate change detection for the newly created component | ||
this._componentRef.changeDetectorRef.markForCheck(); | ||
}; | ||
UIView.prototype.applyUpdatedConfig = function (config) { | ||
this.uiViewData.config = config; | ||
UIView.prototype._applyUpdatedConfig = function (config) { | ||
this._uiViewData.config = config; | ||
// Create the Injector for the routed component | ||
var context = new ResolveContext(config.path); | ||
var componentInjector = this.getComponentInjector(context); | ||
var componentInjector = this._getComponentInjector(context); | ||
// Get the component class from the view declaration. TODO: allow promises? | ||
@@ -166,5 +206,5 @@ var componentClass = config.viewDecl.component; | ||
var compFactory = compFactoryResolver.resolveComponentFactory(componentClass); | ||
this.componentRef = this.componentTarget.createComponent(compFactory, undefined, componentInjector); | ||
this._componentRef = this._componentTarget.createComponent(compFactory, undefined, componentInjector); | ||
// Wire resolves to @Input()s | ||
this.applyInputBindings(compFactory, this.componentRef, context, componentClass); | ||
this._applyInputBindings(compFactory, this._componentRef.instance, context, componentClass); | ||
}; | ||
@@ -181,7 +221,27 @@ /** | ||
*/ | ||
UIView.prototype.getComponentInjector = function (context) { | ||
/** | ||
* Creates a new Injector for a routed component. | ||
* | ||
* Adds resolve values to the Injector | ||
* Adds providers from the NgModule for the state | ||
* Adds providers from the parent Component in the component tree | ||
* Adds a PARENT_INJECT view context object | ||
* | ||
* @returns an Injector | ||
*/ | ||
UIView.prototype._getComponentInjector = /** | ||
* Creates a new Injector for a routed component. | ||
* | ||
* Adds resolve values to the Injector | ||
* Adds providers from the NgModule for the state | ||
* Adds providers from the parent Component in the component tree | ||
* Adds a PARENT_INJECT view context object | ||
* | ||
* @returns an Injector | ||
*/ | ||
function (context) { | ||
// Map resolves to "useValue: providers" | ||
var resolvables = context.getTokens().map(function (token) { return context.getResolvable(token); }).filter(function (r) { return r.resolved; }); | ||
var newProviders = resolvables.map(function (r) { return ({ provide: r.token, useValue: r.data }); }); | ||
var parentInject = { context: this.uiViewData.config.viewDecl.$context, fqn: this.uiViewData.fqn }; | ||
var parentInject = { context: this._uiViewData.config.viewDecl.$context, fqn: this._uiViewData.fqn }; | ||
newProviders.push({ provide: UIView.PARENT_INJECT, useValue: parentInject }); | ||
@@ -199,5 +259,16 @@ var parentComponentInjector = this.viewContainerRef.injector; | ||
*/ | ||
UIView.prototype.applyInputBindings = function (factory, ref, context, componentClass) { | ||
var component = ref.instance; | ||
var bindings = this.uiViewData.config.viewDecl['bindings'] || {}; | ||
/** | ||
* Supplies component inputs with resolve data | ||
* | ||
* Finds component inputs which match resolves (by name) and sets the input value | ||
* to the resolve data. | ||
*/ | ||
UIView.prototype._applyInputBindings = /** | ||
* Supplies component inputs with resolve data | ||
* | ||
* Finds component inputs which match resolves (by name) and sets the input value | ||
* to the resolve data. | ||
*/ | ||
function (factory, component, context, componentClass) { | ||
var bindings = this._uiViewData.config.viewDecl['bindings'] || {}; | ||
var explicitBoundProps = Object.keys(bindings); | ||
@@ -216,6 +287,8 @@ // Returns the actual component property for a renamed an input renamed using `@Input('foo') _foo`. | ||
.filter(function (tuple) { return !inArray(explicitBoundProps, tuple.prop); }); | ||
var addResolvable = function (tuple) { return ({ | ||
prop: tuple.prop, | ||
resolvable: context.getResolvable(tuple.token), | ||
}); }; | ||
var addResolvable = function (tuple) { | ||
return ({ | ||
prop: tuple.prop, | ||
resolvable: context.getResolvable(tuple.token), | ||
}); | ||
}; | ||
explicitInputTuples.concat(implicitInputTuples) | ||
@@ -225,4 +298,2 @@ .map(addResolvable) | ||
.forEach(function (tuple) { component[tuple.prop] = tuple.resolvable.data; }); | ||
// Initiate change detection for the newly created component | ||
ref.changeDetectorRef.detectChanges(); | ||
}; | ||
@@ -233,19 +304,4 @@ UIView.PARENT_INJECT = "UIView.PARENT_INJECT"; | ||
selector: 'ui-view, [ui-view]', | ||
template: "\n <ng-template #componentTarget></ng-template>\n <ng-content *ngIf=\"!componentRef\"></ng-content>\n " | ||
// styles: [` | ||
// .done-true { | ||
// text-decoration: line-through; | ||
// color: grey; | ||
// }` | ||
// ], | ||
// template: ` | ||
// <div style="padding: 1em; border: 1px solid lightgrey;"> | ||
// | ||
// <div #content style="color: lightgrey; font-size: smaller;"> | ||
// <div>ui-view #{{uiViewData?.id}} created by '{{ parentContext?.name || "(root)" }}' state</div> | ||
// <div>name: (absolute) '{{uiViewData?.fqn}}' (contextual) '{{uiViewData?.name}}@{{parentContext?.name}}' </div> | ||
// <div>currently filled by: '{{(uiViewData?.config && uiViewData?.config?.viewDecl?.$context) || 'empty...'}}'</div> | ||
// </div> | ||
// | ||
// </div>` | ||
exportAs: 'uiView', | ||
template: "\n <ng-template #componentTarget></ng-template>\n <ng-content *ngIf=\"!_componentRef\"></ng-content>\n " | ||
},] }, | ||
@@ -260,5 +316,5 @@ ]; | ||
UIView.propDecorators = { | ||
'componentTarget': [{ type: ViewChild, args: ['componentTarget', { read: ViewContainerRef },] },], | ||
'name': [{ type: Input, args: ['name',] },], | ||
'_name': [{ type: Input, args: ['ui-view',] },], | ||
"_componentTarget": [{ type: ViewChild, args: ['componentTarget', { read: ViewContainerRef },] },], | ||
"name": [{ type: Input, args: ['name',] },], | ||
"_name": [{ type: Input, args: ['ui-view',] },], | ||
}; | ||
@@ -268,2 +324,3 @@ return UIView; | ||
export { UIView }; | ||
export { ɵ0 }; | ||
//# sourceMappingURL=uiView.js.map |
@@ -1,1 +0,1 @@ | ||
[{"__symbolic":"module","version":3,"metadata":{"ParentUIViewInject":{"__symbolic":"interface"},"UIView":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component"},"arguments":[{"selector":"ui-view, [ui-view]","template":"\n <ng-template #componentTarget></ng-template>\n <ng-content *ngIf=\"!componentRef\"></ng-content>\n "}]}],"members":{"componentTarget":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ViewChild"},"arguments":["componentTarget",{"read":{"__symbolic":"reference","module":"@angular/core","name":"ViewContainerRef"}}]}]}],"name":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["name"]}]}],"_name":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["ui-view"]}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"select","expression":{"__symbolic":"reference","name":"UIView"},"member":"PARENT_INJECT"}]}],null],"parameters":[{"__symbolic":"reference","module":"@uirouter/core","name":"UIRouter"},null,{"__symbolic":"reference","module":"@angular/core","name":"ViewContainerRef"}]}],"ngOnInit":[{"__symbolic":"method"}],"applyUiCanExitHook":[{"__symbolic":"method"}],"disposeLast":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"viewConfigUpdated":[{"__symbolic":"method"}],"applyUpdatedConfig":[{"__symbolic":"method"}],"getComponentInjector":[{"__symbolic":"method"}],"applyInputBindings":[{"__symbolic":"method"}]},"statics":{"PARENT_INJECT":"UIView.PARENT_INJECT"}}}},{"__symbolic":"module","version":1,"metadata":{"ParentUIViewInject":{"__symbolic":"interface"},"UIView":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component"},"arguments":[{"selector":"ui-view, [ui-view]","template":"\n <ng-template #componentTarget></ng-template>\n <ng-content *ngIf=\"!componentRef\"></ng-content>\n "}]}],"members":{"componentTarget":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ViewChild"},"arguments":["componentTarget",{"read":{"__symbolic":"reference","module":"@angular/core","name":"ViewContainerRef"}}]}]}],"name":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["name"]}]}],"_name":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["ui-view"]}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"select","expression":{"__symbolic":"reference","name":"UIView"},"member":"PARENT_INJECT"}]}],null],"parameters":[{"__symbolic":"reference","module":"@uirouter/core","name":"UIRouter"},null,{"__symbolic":"reference","module":"@angular/core","name":"ViewContainerRef"}]}],"ngOnInit":[{"__symbolic":"method"}],"applyUiCanExitHook":[{"__symbolic":"method"}],"disposeLast":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"viewConfigUpdated":[{"__symbolic":"method"}],"applyUpdatedConfig":[{"__symbolic":"method"}],"getComponentInjector":[{"__symbolic":"method"}],"applyInputBindings":[{"__symbolic":"method"}]},"statics":{"PARENT_INJECT":"UIView.PARENT_INJECT"}}}}] | ||
[{"__symbolic":"module","version":4,"metadata":{"ParentUIViewInject":{"__symbolic":"interface"},"ɵ0":{"__symbolic":"error","message":"Function call not supported","line":37,"character":27},"UIView":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component"},"arguments":[{"selector":"ui-view, [ui-view]","exportAs":"uiView","template":"\n <ng-template #componentTarget></ng-template>\n <ng-content *ngIf=\"!_componentRef\"></ng-content>\n "}]}],"members":{"_componentTarget":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ViewChild"},"arguments":["componentTarget",{"read":{"__symbolic":"reference","module":"@angular/core","name":"ViewContainerRef"}}]}]}],"name":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["name"]}]}],"_name":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["ui-view"]}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"select","expression":{"__symbolic":"reference","name":"UIView"},"member":"PARENT_INJECT"}]}],null],"parameters":[{"__symbolic":"reference","module":"@uirouter/core","name":"UIRouter"},null,{"__symbolic":"reference","module":"@angular/core","name":"ViewContainerRef"}]}],"ngOnInit":[{"__symbolic":"method"}],"_applyUiCanExitHook":[{"__symbolic":"method"}],"_disposeLast":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"_viewConfigUpdated":[{"__symbolic":"method"}],"_applyUpdatedConfig":[{"__symbolic":"method"}],"_getComponentInjector":[{"__symbolic":"method"}],"_applyInputBindings":[{"__symbolic":"method"}]},"statics":{"PARENT_INJECT":"UIView.PARENT_INJECT"}}}}] |
@@ -1,1 +0,1 @@ | ||
[{"__symbolic":"module","version":3,"metadata":{},"exports":[{"from":"./interface"},{"from":"./providers"},{"from":"./uiRouterNgModule"},{"from":"./uiRouterConfig"},{"from":"./directives/directives"},{"from":"./statebuilders/views"},{"from":"./statebuilders/lazyLoad"},{"from":"./lazyLoad/lazyLoadNgModule"},{"from":"@uirouter/core"}]},{"__symbolic":"module","version":1,"metadata":{},"exports":[{"from":"./interface"},{"from":"./providers"},{"from":"./uiRouterNgModule"},{"from":"./uiRouterConfig"},{"from":"./directives/directives"},{"from":"./statebuilders/views"},{"from":"./statebuilders/lazyLoad"},{"from":"./lazyLoad/lazyLoadNgModule"},{"from":"@uirouter/core"}]}] | ||
[{"__symbolic":"module","version":4,"metadata":{},"exports":[{"from":"./interface"},{"from":"./providers"},{"from":"./uiRouterNgModule"},{"from":"./uiRouterConfig"},{"from":"./directives/directives"},{"from":"./statebuilders/views"},{"from":"./statebuilders/lazyLoad"},{"from":"./lazyLoad/lazyLoadNgModule"},{"from":"@uirouter/core"}]}] |
@@ -1,1 +0,1 @@ | ||
[{"__symbolic":"module","version":3,"metadata":{"Ng2StateDeclaration":{"__symbolic":"interface"},"Ng2ViewDeclaration":{"__symbolic":"interface"},"Ng2Component":{"__symbolic":"interface"}}},{"__symbolic":"module","version":1,"metadata":{"Ng2StateDeclaration":{"__symbolic":"interface"},"Ng2ViewDeclaration":{"__symbolic":"interface"},"Ng2Component":{"__symbolic":"interface"}}}] | ||
[{"__symbolic":"module","version":4,"metadata":{"Ng2StateDeclaration":{"__symbolic":"interface"},"Ng2ViewDeclaration":{"__symbolic":"interface"},"Ng2Component":{"__symbolic":"interface"}}}] |
/** @ng2api @module core */ | ||
/** */ | ||
import { NgModuleRef, Injector, NgModuleFactory, Type } from "@angular/core"; | ||
import { Transition, LazyLoadResult } from "@uirouter/core"; | ||
import { Transition, LazyLoadResult, StateDeclaration } from "@uirouter/core"; | ||
import { RootModule } from "../uiRouterNgModule"; | ||
@@ -68,3 +68,3 @@ /** | ||
*/ | ||
export declare function loadNgModule(moduleToLoad: NgModuleToLoad): (transition: Transition) => Promise<LazyLoadResult>; | ||
export declare function loadNgModule(moduleToLoad: NgModuleToLoad): (transition: Transition, stateObject: StateDeclaration) => Promise<LazyLoadResult>; | ||
/** | ||
@@ -98,3 +98,3 @@ * Returns the module factory that can be used to instantiate a module | ||
*/ | ||
export declare function applyNgModule(transition: Transition, ng2Module: NgModuleRef<any>): LazyLoadResult; | ||
export declare function applyNgModule(transition: Transition, ng2Module: NgModuleRef<any>, parentInjector: Injector, lazyLoadState: StateDeclaration): LazyLoadResult; | ||
/** | ||
@@ -101,0 +101,0 @@ * Returns the new dependency injection values from the Child Injector |
@@ -47,3 +47,3 @@ /** @ng2api @module core */ | ||
export function loadNgModule(moduleToLoad) { | ||
return function (transition) { | ||
return function (transition, stateObject) { | ||
var ng2Injector = transition.injector().get(NATIVE_INJECTOR_TOKEN); | ||
@@ -54,3 +54,3 @@ var createModule = function (factory) { | ||
var applyModule = function (moduleRef) { | ||
return applyNgModule(transition, moduleRef); | ||
return applyNgModule(transition, moduleRef, ng2Injector, stateObject); | ||
}; | ||
@@ -104,8 +104,7 @@ return loadModuleFactory(moduleToLoad, ng2Injector) | ||
*/ | ||
export function applyNgModule(transition, ng2Module) { | ||
export function applyNgModule(transition, ng2Module, parentInjector, lazyLoadState) { | ||
var injector = ng2Module.injector; | ||
var parentInjector = ng2Module.injector['parent'] || ng2Module.injector['_parent']; | ||
var uiRouter = injector.get(UIRouter); | ||
var registry = uiRouter.stateRegistry; | ||
var originalName = transition.to().name; | ||
var originalName = lazyLoadState.name; | ||
var originalState = registry.get(originalName); | ||
@@ -128,9 +127,11 @@ // Check if it's a future state (ends with .**) | ||
.reduce(uniqR, []); | ||
var replacementState = registry.get(replacementName); | ||
if (!replacementState || replacementState === originalState) { | ||
throw new Error("The Future State named '" + originalName + "' lazy loaded an NgModule. " + | ||
("The lazy loaded NgModule must have a state named '" + replacementName + "' ") + | ||
("which replaces the (placeholder) '" + originalName + "' Future State. ") + | ||
("Add a '" + replacementName + "' state to the lazy loaded NgModule ") + | ||
"using UIRouterModule.forChild({ states: CHILD_STATES })."); | ||
if (isFuture) { | ||
var replacementState = registry.get(replacementName); | ||
if (!replacementState || replacementState === originalState) { | ||
throw new Error("The Future State named '" + originalName + "' lazy loaded an NgModule. " + | ||
("The lazy loaded NgModule must have a state named '" + replacementName + "' ") + | ||
("which replaces the (placeholder) '" + originalName + "' Future State. ") + | ||
("Add a '" + replacementName + "' state to the lazy loaded NgModule ") + | ||
"using UIRouterModule.forChild({ states: CHILD_STATES })."); | ||
} | ||
} | ||
@@ -137,0 +138,0 @@ // Supply the newly loaded states with the Injector from the lazy loaded NgModule. |
@@ -1,1 +0,1 @@ | ||
[{"__symbolic":"module","version":3,"metadata":{"loadNgModule":{"__symbolic":"function","parameters":["moduleToLoad"],"value":{"__symbolic":"error","message":"Function call not supported","line":74,"character":9}},"loadModuleFactory":{"__symbolic":"function"},"applyNgModule":{"__symbolic":"function"},"multiProviderParentChildDelta":{"__symbolic":"function"}}},{"__symbolic":"module","version":1,"metadata":{"loadNgModule":{"__symbolic":"function","parameters":["moduleToLoad"],"value":{"__symbolic":"error","message":"Function call not supported","line":74,"character":9}},"loadModuleFactory":{"__symbolic":"function"},"applyNgModule":{"__symbolic":"function"},"multiProviderParentChildDelta":{"__symbolic":"function"}}}] | ||
[{"__symbolic":"module","version":4,"metadata":{"ModuleTypeCallback":{"__symbolic":"interface"},"NgModuleToLoad":{"__symbolic":"interface"},"loadNgModule":{"__symbolic":"function","parameters":["moduleToLoad"],"value":{"__symbolic":"error","message":"Function call not supported","line":74,"character":9}},"loadModuleFactory":{"__symbolic":"function"},"applyNgModule":{"__symbolic":"function"},"multiProviderParentChildDelta":{"__symbolic":"function"}}}] |
@@ -1,1 +0,1 @@ | ||
[{"__symbolic":"module","version":3,"metadata":{"Ng2LocationConfig":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"@uirouter/core","name":"BrowserLocationConfig"},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@uirouter/core","name":"UIRouter"},{"__symbolic":"reference","module":"@angular/common","name":"LocationStrategy"}]}],"baseHref":[{"__symbolic":"method"}]}}}},{"__symbolic":"module","version":1,"metadata":{"Ng2LocationConfig":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"@uirouter/core","name":"BrowserLocationConfig"},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@uirouter/core","name":"UIRouter"},{"__symbolic":"reference","module":"@angular/common","name":"LocationStrategy"}]}],"baseHref":[{"__symbolic":"method"}]}}}}] | ||
[{"__symbolic":"module","version":4,"metadata":{"Ng2LocationConfig":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"@uirouter/core","name":"BrowserLocationConfig"},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@uirouter/core","name":"UIRouter"},{"__symbolic":"reference","module":"@angular/common","name":"LocationStrategy"}]}],"baseHref":[{"__symbolic":"method"}]}}}}] |
@@ -6,3 +6,4 @@ import * as tslib_1 from "tslib"; | ||
/** A `LocationServices` that delegates to the Angular LocationStrategy */ | ||
var Ng2LocationServices = (function (_super) { | ||
var /** A `LocationServices` that delegates to the Angular LocationStrategy */ | ||
Ng2LocationServices = (function (_super) { | ||
tslib_1.__extends(Ng2LocationServices, _super); | ||
@@ -38,3 +39,4 @@ function Ng2LocationServices(router, _locationStrategy, isBrowser) { | ||
}(BaseLocationServices)); | ||
/** A `LocationServices` that delegates to the Angular LocationStrategy */ | ||
export { Ng2LocationServices }; | ||
//# sourceMappingURL=locationService.js.map |
@@ -1,1 +0,1 @@ | ||
[{"__symbolic":"module","version":3,"metadata":{"Ng2LocationServices":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"@uirouter/core","name":"BaseLocationServices"},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@uirouter/core","name":"UIRouter"},{"__symbolic":"reference","module":"@angular/common","name":"LocationStrategy"},{"__symbolic":"reference","name":"boolean"}]}],"_get":[{"__symbolic":"method"}],"_set":[{"__symbolic":"method"}],"dispose":[{"__symbolic":"method"}]}}}},{"__symbolic":"module","version":1,"metadata":{"Ng2LocationServices":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"@uirouter/core","name":"BaseLocationServices"},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@uirouter/core","name":"UIRouter"},{"__symbolic":"reference","module":"@angular/common","name":"LocationStrategy"},{"__symbolic":"reference","name":"boolean"}]}],"_get":[{"__symbolic":"method"}],"_set":[{"__symbolic":"method"}],"dispose":[{"__symbolic":"method"}]}}}}] | ||
[{"__symbolic":"module","version":4,"metadata":{"Ng2LocationServices":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"@uirouter/core","name":"BaseLocationServices"},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@uirouter/core","name":"UIRouter"},{"__symbolic":"reference","module":"@angular/common","name":"LocationStrategy"},{"__symbolic":"reference","name":"boolean"}]}],"_get":[{"__symbolic":"method"}],"_set":[{"__symbolic":"method"}],"dispose":[{"__symbolic":"method"}]}}}}] |
@@ -28,3 +28,25 @@ /** | ||
*/ | ||
MergeInjector.prototype.get = function (token, notFoundValue) { | ||
/** | ||
* Get the token from the first injector which contains it. | ||
* | ||
* Delegates to the first Injector.get(). | ||
* If not found, then delegates to the second Injector (and so forth). | ||
* If no Injector contains the token, return the `notFoundValue`, or throw. | ||
* | ||
* @param token the DI token | ||
* @param notFoundValue the value to return if none of the Injectors contains the token. | ||
* @returns {any} the DI value | ||
*/ | ||
MergeInjector.prototype.get = /** | ||
* Get the token from the first injector which contains it. | ||
* | ||
* Delegates to the first Injector.get(). | ||
* If not found, then delegates to the second Injector (and so forth). | ||
* If no Injector contains the token, return the `notFoundValue`, or throw. | ||
* | ||
* @param token the DI token | ||
* @param notFoundValue the value to return if none of the Injectors contains the token. | ||
* @returns {any} the DI value | ||
*/ | ||
function (token, notFoundValue) { | ||
for (var i = 0; i < this.injectors.length; i++) { | ||
@@ -31,0 +53,0 @@ var val = this.injectors[i].get(token, MergeInjector.NOT_FOUND); |
@@ -1,1 +0,1 @@ | ||
[{"__symbolic":"module","version":3,"metadata":{"MergeInjector":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","module":"@angular/core","name":"Injector"}]}]}],"get":[{"__symbolic":"method"}]},"statics":{"NOT_FOUND":{}}}}},{"__symbolic":"module","version":1,"metadata":{"MergeInjector":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","module":"@angular/core","name":"Injector"}]}]}],"get":[{"__symbolic":"method"}]},"statics":{"NOT_FOUND":{}}}}}] | ||
[{"__symbolic":"module","version":4,"metadata":{"MergeInjector":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","module":"@angular/core","name":"Injector"}]}]}],"get":[{"__symbolic":"method"}]},"statics":{"NOT_FOUND":{}}}}}] |
@@ -1,1 +0,1 @@ | ||
[{"__symbolic":"module","version":3,"metadata":{"uiRouterFactory":{"__symbolic":"function"},"parentUIViewInjectFactory":{"__symbolic":"function","parameters":["r"],"value":{"__symbolic":"error","message":"Expression form not supported","line":165,"character":69}},"_UIROUTER_INSTANCE_PROVIDERS":[{"provide":{"__symbolic":"reference","module":"@uirouter/core","name":"UIRouter"},"useFactory":{"__symbolic":"reference","name":"uiRouterFactory"},"deps":[{"__symbolic":"reference","module":"@angular/common","name":"LocationStrategy"},{"__symbolic":"reference","module":"./uiRouterNgModule","name":"UIROUTER_ROOT_MODULE"},{"__symbolic":"reference","module":"./uiRouterNgModule","name":"UIROUTER_MODULE_TOKEN"},{"__symbolic":"reference","module":"@angular/core","name":"Injector"}]},{"provide":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"./directives/uiView","name":"UIView"},"member":"PARENT_INJECT"},"useFactory":{"__symbolic":"reference","name":"parentUIViewInjectFactory"},"deps":[{"__symbolic":"reference","module":"@uirouter/core","name":"StateRegistry"}]}],"fnStateService":{"__symbolic":"function","parameters":["r"],"value":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"r"},"member":"stateService"}},"fnTransitionService":{"__symbolic":"function","parameters":["r"],"value":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"r"},"member":"transitionService"}},"fnUrlMatcherFactory":{"__symbolic":"function","parameters":["r"],"value":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"r"},"member":"urlMatcherFactory"}},"fnUrlRouter":{"__symbolic":"function","parameters":["r"],"value":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"r"},"member":"urlRouter"}},"fnUrlService":{"__symbolic":"function","parameters":["r"],"value":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"r"},"member":"urlService"}},"fnViewService":{"__symbolic":"function","parameters":["r"],"value":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"r"},"member":"viewService"}},"fnStateRegistry":{"__symbolic":"function","parameters":["r"],"value":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"r"},"member":"stateRegistry"}},"fnGlobals":{"__symbolic":"function","parameters":["r"],"value":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"r"},"member":"globals"}},"_UIROUTER_SERVICE_PROVIDERS":[{"provide":{"__symbolic":"reference","module":"@uirouter/core","name":"StateService"},"useFactory":{"__symbolic":"reference","name":"fnStateService"},"deps":[{"__symbolic":"reference","module":"@uirouter/core","name":"UIRouter"}]},{"provide":{"__symbolic":"reference","module":"@uirouter/core","name":"TransitionService"},"useFactory":{"__symbolic":"reference","name":"fnTransitionService"},"deps":[{"__symbolic":"reference","module":"@uirouter/core","name":"UIRouter"}]},{"provide":{"__symbolic":"reference","module":"@uirouter/core","name":"UrlMatcherFactory"},"useFactory":{"__symbolic":"reference","name":"fnUrlMatcherFactory"},"deps":[{"__symbolic":"reference","module":"@uirouter/core","name":"UIRouter"}]},{"provide":{"__symbolic":"reference","module":"@uirouter/core","name":"UrlRouter"},"useFactory":{"__symbolic":"reference","name":"fnUrlRouter"},"deps":[{"__symbolic":"reference","module":"@uirouter/core","name":"UIRouter"}]},{"provide":{"__symbolic":"reference","module":"@uirouter/core","name":"UrlService"},"useFactory":{"__symbolic":"reference","name":"fnUrlService"},"deps":[{"__symbolic":"reference","module":"@uirouter/core","name":"UIRouter"}]},{"provide":{"__symbolic":"reference","module":"@uirouter/core","name":"ViewService"},"useFactory":{"__symbolic":"reference","name":"fnViewService"},"deps":[{"__symbolic":"reference","module":"@uirouter/core","name":"UIRouter"}]},{"provide":{"__symbolic":"reference","module":"@uirouter/core","name":"StateRegistry"},"useFactory":{"__symbolic":"reference","name":"fnStateRegistry"},"deps":[{"__symbolic":"reference","module":"@uirouter/core","name":"UIRouter"}]},{"provide":{"__symbolic":"reference","module":"@uirouter/core","name":"UIRouterGlobals"},"useFactory":{"__symbolic":"reference","name":"fnGlobals"},"deps":[{"__symbolic":"reference","module":"@uirouter/core","name":"UIRouter"}]}],"UIROUTER_PROVIDERS":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"_UIROUTER_INSTANCE_PROVIDERS"},"member":"concat"},"arguments":[{"__symbolic":"reference","name":"_UIROUTER_SERVICE_PROVIDERS"}]}}},{"__symbolic":"module","version":1,"metadata":{"uiRouterFactory":{"__symbolic":"function"},"parentUIViewInjectFactory":{"__symbolic":"function","parameters":["r"],"value":{"__symbolic":"error","message":"Expression form not supported","line":165,"character":69}},"_UIROUTER_INSTANCE_PROVIDERS":[{"provide":{"__symbolic":"reference","module":"@uirouter/core","name":"UIRouter"},"useFactory":{"__symbolic":"reference","name":"uiRouterFactory"},"deps":[{"__symbolic":"reference","module":"@angular/common","name":"LocationStrategy"},{"__symbolic":"reference","module":"./uiRouterNgModule","name":"UIROUTER_ROOT_MODULE"},{"__symbolic":"reference","module":"./uiRouterNgModule","name":"UIROUTER_MODULE_TOKEN"},{"__symbolic":"reference","module":"@angular/core","name":"Injector"}]},{"provide":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"./directives/uiView","name":"UIView"},"member":"PARENT_INJECT"},"useFactory":{"__symbolic":"reference","name":"parentUIViewInjectFactory"},"deps":[{"__symbolic":"reference","module":"@uirouter/core","name":"StateRegistry"}]}],"fnStateService":{"__symbolic":"function","parameters":["r"],"value":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"r"},"member":"stateService"}},"fnTransitionService":{"__symbolic":"function","parameters":["r"],"value":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"r"},"member":"transitionService"}},"fnUrlMatcherFactory":{"__symbolic":"function","parameters":["r"],"value":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"r"},"member":"urlMatcherFactory"}},"fnUrlRouter":{"__symbolic":"function","parameters":["r"],"value":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"r"},"member":"urlRouter"}},"fnUrlService":{"__symbolic":"function","parameters":["r"],"value":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"r"},"member":"urlService"}},"fnViewService":{"__symbolic":"function","parameters":["r"],"value":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"r"},"member":"viewService"}},"fnStateRegistry":{"__symbolic":"function","parameters":["r"],"value":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"r"},"member":"stateRegistry"}},"fnGlobals":{"__symbolic":"function","parameters":["r"],"value":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"r"},"member":"globals"}},"_UIROUTER_SERVICE_PROVIDERS":[{"provide":{"__symbolic":"reference","module":"@uirouter/core","name":"StateService"},"useFactory":{"__symbolic":"reference","name":"fnStateService"},"deps":[{"__symbolic":"reference","module":"@uirouter/core","name":"UIRouter"}]},{"provide":{"__symbolic":"reference","module":"@uirouter/core","name":"TransitionService"},"useFactory":{"__symbolic":"reference","name":"fnTransitionService"},"deps":[{"__symbolic":"reference","module":"@uirouter/core","name":"UIRouter"}]},{"provide":{"__symbolic":"reference","module":"@uirouter/core","name":"UrlMatcherFactory"},"useFactory":{"__symbolic":"reference","name":"fnUrlMatcherFactory"},"deps":[{"__symbolic":"reference","module":"@uirouter/core","name":"UIRouter"}]},{"provide":{"__symbolic":"reference","module":"@uirouter/core","name":"UrlRouter"},"useFactory":{"__symbolic":"reference","name":"fnUrlRouter"},"deps":[{"__symbolic":"reference","module":"@uirouter/core","name":"UIRouter"}]},{"provide":{"__symbolic":"reference","module":"@uirouter/core","name":"UrlService"},"useFactory":{"__symbolic":"reference","name":"fnUrlService"},"deps":[{"__symbolic":"reference","module":"@uirouter/core","name":"UIRouter"}]},{"provide":{"__symbolic":"reference","module":"@uirouter/core","name":"ViewService"},"useFactory":{"__symbolic":"reference","name":"fnViewService"},"deps":[{"__symbolic":"reference","module":"@uirouter/core","name":"UIRouter"}]},{"provide":{"__symbolic":"reference","module":"@uirouter/core","name":"StateRegistry"},"useFactory":{"__symbolic":"reference","name":"fnStateRegistry"},"deps":[{"__symbolic":"reference","module":"@uirouter/core","name":"UIRouter"}]},{"provide":{"__symbolic":"reference","module":"@uirouter/core","name":"UIRouterGlobals"},"useFactory":{"__symbolic":"reference","name":"fnGlobals"},"deps":[{"__symbolic":"reference","module":"@uirouter/core","name":"UIRouter"}]}],"UIROUTER_PROVIDERS":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"_UIROUTER_INSTANCE_PROVIDERS"},"member":"concat"},"arguments":[{"__symbolic":"reference","name":"_UIROUTER_SERVICE_PROVIDERS"}]}}}] | ||
[{"__symbolic":"module","version":4,"metadata":{"uiRouterFactory":{"__symbolic":"function"},"parentUIViewInjectFactory":{"__symbolic":"function","parameters":["r"],"value":{"fqn":null,"context":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"r"},"member":"root"}}}},"_UIROUTER_INSTANCE_PROVIDERS":[{"provide":{"__symbolic":"reference","module":"@uirouter/core","name":"UIRouter"},"useFactory":{"__symbolic":"reference","name":"uiRouterFactory"},"deps":[{"__symbolic":"reference","module":"@angular/common","name":"LocationStrategy"},{"__symbolic":"reference","module":"./uiRouterNgModule","name":"UIROUTER_ROOT_MODULE"},{"__symbolic":"reference","module":"./uiRouterNgModule","name":"UIROUTER_MODULE_TOKEN"},{"__symbolic":"reference","module":"@angular/core","name":"Injector"}]},{"provide":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"./directives/uiView","name":"UIView"},"member":"PARENT_INJECT"},"useFactory":{"__symbolic":"reference","name":"parentUIViewInjectFactory"},"deps":[{"__symbolic":"reference","module":"@uirouter/core","name":"StateRegistry"}]}],"fnStateService":{"__symbolic":"function","parameters":["r"],"value":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"r"},"member":"stateService"}},"fnTransitionService":{"__symbolic":"function","parameters":["r"],"value":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"r"},"member":"transitionService"}},"fnUrlMatcherFactory":{"__symbolic":"function","parameters":["r"],"value":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"r"},"member":"urlMatcherFactory"}},"fnUrlRouter":{"__symbolic":"function","parameters":["r"],"value":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"r"},"member":"urlRouter"}},"fnUrlService":{"__symbolic":"function","parameters":["r"],"value":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"r"},"member":"urlService"}},"fnViewService":{"__symbolic":"function","parameters":["r"],"value":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"r"},"member":"viewService"}},"fnStateRegistry":{"__symbolic":"function","parameters":["r"],"value":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"r"},"member":"stateRegistry"}},"fnGlobals":{"__symbolic":"function","parameters":["r"],"value":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"r"},"member":"globals"}},"_UIROUTER_SERVICE_PROVIDERS":[{"provide":{"__symbolic":"reference","module":"@uirouter/core","name":"StateService"},"useFactory":{"__symbolic":"reference","name":"fnStateService"},"deps":[{"__symbolic":"reference","module":"@uirouter/core","name":"UIRouter"}]},{"provide":{"__symbolic":"reference","module":"@uirouter/core","name":"TransitionService"},"useFactory":{"__symbolic":"reference","name":"fnTransitionService"},"deps":[{"__symbolic":"reference","module":"@uirouter/core","name":"UIRouter"}]},{"provide":{"__symbolic":"reference","module":"@uirouter/core","name":"UrlMatcherFactory"},"useFactory":{"__symbolic":"reference","name":"fnUrlMatcherFactory"},"deps":[{"__symbolic":"reference","module":"@uirouter/core","name":"UIRouter"}]},{"provide":{"__symbolic":"reference","module":"@uirouter/core","name":"UrlRouter"},"useFactory":{"__symbolic":"reference","name":"fnUrlRouter"},"deps":[{"__symbolic":"reference","module":"@uirouter/core","name":"UIRouter"}]},{"provide":{"__symbolic":"reference","module":"@uirouter/core","name":"UrlService"},"useFactory":{"__symbolic":"reference","name":"fnUrlService"},"deps":[{"__symbolic":"reference","module":"@uirouter/core","name":"UIRouter"}]},{"provide":{"__symbolic":"reference","module":"@uirouter/core","name":"ViewService"},"useFactory":{"__symbolic":"reference","name":"fnViewService"},"deps":[{"__symbolic":"reference","module":"@uirouter/core","name":"UIRouter"}]},{"provide":{"__symbolic":"reference","module":"@uirouter/core","name":"StateRegistry"},"useFactory":{"__symbolic":"reference","name":"fnStateRegistry"},"deps":[{"__symbolic":"reference","module":"@uirouter/core","name":"UIRouter"}]},{"provide":{"__symbolic":"reference","module":"@uirouter/core","name":"UIRouterGlobals"},"useFactory":{"__symbolic":"reference","name":"fnGlobals"},"deps":[{"__symbolic":"reference","module":"@uirouter/core","name":"UIRouter"}]}],"UIROUTER_PROVIDERS":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"_UIROUTER_INSTANCE_PROVIDERS"},"member":"concat"},"arguments":[{"__symbolic":"reference","name":"_UIROUTER_SERVICE_PROVIDERS"}]}}}] |
@@ -48,2 +48,2 @@ /** @module ng2 */ | ||
*/ | ||
export declare function ng2LazyLoadBuilder(state: StateObject, parent: BuilderFunction): (transition: Transition, state: StateDeclaration) => Promise<LazyLoadResult>; | ||
export declare function ng2LazyLoadBuilder(state: StateObject, parent: BuilderFunction): (transition: Transition, stateObject: StateDeclaration) => Promise<LazyLoadResult>; |
@@ -1,1 +0,1 @@ | ||
[{"__symbolic":"module","version":3,"metadata":{"ng2LazyLoadBuilder":{"__symbolic":"function"}}},{"__symbolic":"module","version":1,"metadata":{"ng2LazyLoadBuilder":{"__symbolic":"function"}}}] | ||
[{"__symbolic":"module","version":4,"metadata":{"ng2LazyLoadBuilder":{"__symbolic":"function"}}}] |
@@ -1,1 +0,1 @@ | ||
[{"__symbolic":"module","version":3,"metadata":{"ng2ViewsBuilder":{"__symbolic":"function"},"Ng2ViewConfig":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","module":"@uirouter/core","name":"PathNode"}]},{"__symbolic":"reference","module":"../interface","name":"Ng2ViewDeclaration"}]}],"load":[{"__symbolic":"method"}]}}}},{"__symbolic":"module","version":1,"metadata":{"ng2ViewsBuilder":{"__symbolic":"function"},"Ng2ViewConfig":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","module":"@uirouter/core","name":"PathNode"}]},{"__symbolic":"reference","module":"../interface","name":"Ng2ViewDeclaration"}]}],"load":[{"__symbolic":"method"}]}}}}] | ||
[{"__symbolic":"module","version":4,"metadata":{"ng2ViewsBuilder":{"__symbolic":"function"},"Ng2ViewConfig":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","module":"@uirouter/core","name":"PathNode"}]},{"__symbolic":"reference","module":"../interface","name":"Ng2ViewDeclaration"}]}],"load":[{"__symbolic":"method"}]}}}}] |
@@ -15,3 +15,4 @@ /** @module ng2 */ /** */ | ||
isDefined(module.otherwise) && uiRouter.urlService.rules.otherwise(module.otherwise); | ||
isDefined(module.initial) && uiRouter.urlService.rules.initial(module.initial); | ||
} | ||
//# sourceMappingURL=uiRouterConfig.js.map |
@@ -1,1 +0,1 @@ | ||
[{"__symbolic":"module","version":3,"metadata":{"applyModuleConfig":{"__symbolic":"function"},"applyRootModuleConfig":{"__symbolic":"function"}}},{"__symbolic":"module","version":1,"metadata":{"applyModuleConfig":{"__symbolic":"function"},"applyRootModuleConfig":{"__symbolic":"function"}}}] | ||
[{"__symbolic":"module","version":4,"metadata":{"applyModuleConfig":{"__symbolic":"function"},"applyRootModuleConfig":{"__symbolic":"function"}}}] |
/** @ng2api @module core */ | ||
/** */ | ||
import { Ng2StateDeclaration } from "./interface"; | ||
import { OpaqueToken, ModuleWithProviders, Provider, Injector } from "@angular/core"; | ||
import { ModuleWithProviders, Provider, Injector, InjectionToken } from "@angular/core"; | ||
import { LocationStrategy, HashLocationStrategy, PathLocationStrategy } from "@angular/common"; | ||
import { UrlRuleHandlerFn, TargetState, TargetStateDef, UIRouter } from "@uirouter/core"; | ||
/** @hidden */ export declare const UIROUTER_ROOT_MODULE: OpaqueToken; | ||
/** @hidden */ export declare const UIROUTER_MODULE_TOKEN: OpaqueToken; | ||
/** @hidden */ export declare const UIROUTER_STATES: OpaqueToken; | ||
export declare function makeRootProviders(module: StatesModule): Provider[]; | ||
import { UrlRuleHandlerFn, TargetState, TargetStateDef, UIRouter, TransitionService } from "@uirouter/core"; | ||
/** @hidden */ export declare const UIROUTER_ROOT_MODULE: InjectionToken<{}>; | ||
/** @hidden */ export declare const UIROUTER_MODULE_TOKEN: InjectionToken<{}>; | ||
/** @hidden */ export declare const UIROUTER_STATES: InjectionToken<{}>; | ||
export declare function onTransitionReady(transitionService: TransitionService, root: RootModule[]): (() => Promise<void>) | (() => Promise<{}>); | ||
export declare function makeRootProviders(module: RootModule): Provider[]; | ||
export declare function makeChildProviders(module: StatesModule): Provider[]; | ||
@@ -118,9 +119,28 @@ export declare function locationStrategy(useHash: any): { | ||
/** | ||
* Sets [[UrlRouterProvider.otherwise]]. | ||
* Configures the `otherwise` rule, which chooses the state or URL to activate when no other routes matched. | ||
* | ||
* See: [[UrlRulesApi.otherwise]]. | ||
*/ | ||
otherwise?: (string | UrlRuleHandlerFn | TargetState | TargetStateDef); | ||
/** | ||
* Configures the `initial` rule, which chooses the state or URL to activate when the | ||
* application initially starts, and no other routes matched. | ||
* | ||
* See: [[UrlRulesApi.initial]]. | ||
*/ | ||
initial?: (string | UrlRuleHandlerFn | TargetState | TargetStateDef); | ||
/** | ||
* Sets [[UrlRouterProvider.deferIntercept]] | ||
*/ | ||
deferIntercept?: boolean; | ||
/** | ||
* Tells Angular to defer the first render until after the initial transition is complete. | ||
* | ||
* When `true`, adds an async `APP_INITIALIZER` which is resolved after any `onSuccess` or `onError`. | ||
* The initializer stops angular from rendering the root component until after the first transition completes. | ||
* This may prevent initial page flicker while the state is being loaded. | ||
* | ||
* Defaults to `false` | ||
*/ | ||
deferInitialRender?: boolean; | ||
} | ||
@@ -127,0 +147,0 @@ /** |
@@ -1,11 +0,26 @@ | ||
import { NgModule, OpaqueToken, ANALYZE_FOR_ENTRY_COMPONENTS } from "@angular/core"; | ||
import { NgModule, ANALYZE_FOR_ENTRY_COMPONENTS, InjectionToken, APP_INITIALIZER, } from "@angular/core"; | ||
import { CommonModule, LocationStrategy, HashLocationStrategy, PathLocationStrategy } from "@angular/common"; | ||
import { _UIROUTER_DIRECTIVES } from "./directives/directives"; | ||
import { UIView } from "./directives/uiView"; | ||
import { TransitionService } from "@uirouter/core"; | ||
import { _UIROUTER_INSTANCE_PROVIDERS, _UIROUTER_SERVICE_PROVIDERS } from "./providers"; | ||
import { ROUTES } from "@angular/router"; | ||
/** @hidden */ export var UIROUTER_ROOT_MODULE = new OpaqueToken("UIRouter Root Module"); | ||
/** @hidden */ export var UIROUTER_MODULE_TOKEN = new OpaqueToken("UIRouter Module"); | ||
/** @hidden */ export var UIROUTER_STATES = new OpaqueToken("UIRouter States"); | ||
/** @hidden */ export var UIROUTER_ROOT_MODULE = new InjectionToken("UIRouter Root Module"); | ||
/** @hidden */ export var UIROUTER_MODULE_TOKEN = new InjectionToken("UIRouter Module"); | ||
/** @hidden */ export var UIROUTER_STATES = new InjectionToken("UIRouter States"); | ||
// /** @hidden */ export const ROUTES = UIROUTER_STATES; | ||
// Delay angular bootstrap until first transition is successful, for SSR. | ||
// See https://github.com/ui-router/angular/pull/127 | ||
export function onTransitionReady(transitionService, root) { | ||
var mod = root[0]; | ||
if (!mod || !mod.deferInitialRender) { | ||
return function () { return Promise.resolve(); }; | ||
} | ||
return function () { | ||
return new Promise(function (resolve) { | ||
var hook = function (trans) { trans.promise.then(resolve, resolve); }; | ||
transitionService.onStart({}, hook, { invokeLimit: 1 }); | ||
}); | ||
}; | ||
} | ||
export function makeRootProviders(module) { | ||
@@ -17,2 +32,3 @@ return [ | ||
{ provide: ANALYZE_FOR_ENTRY_COMPONENTS, useValue: module.states || [], multi: true }, | ||
{ provide: APP_INITIALIZER, useFactory: onTransitionReady, deps: [TransitionService, UIROUTER_ROOT_MODULE], multi: true }, | ||
]; | ||
@@ -90,3 +106,75 @@ } | ||
*/ | ||
UIRouterModule.forRoot = function (config) { | ||
/** | ||
* Creates a UI-Router Module for the root (bootstrapped) application module to import | ||
* | ||
* This factory function creates an [Angular NgModule](https://angular.io/docs/ts/latest/guide/ngmodule.html) | ||
* with UI-Router support. | ||
* | ||
* The `forRoot` module should be added to the `imports:` of the `NgModule` being bootstrapped. | ||
* An application should only create and import a single `NgModule` using `forRoot()`. | ||
* All other modules should be created using [[UIRouterModule.forChild]]. | ||
* | ||
* Unlike `forChild`, an `NgModule` returned by this factory provides the [[UIRouter]] singleton object. | ||
* This factory also accepts root-level router configuration. | ||
* These are the only differences between `forRoot` and `forChild`. | ||
* | ||
* Example: | ||
* ```js | ||
* let routerConfig = { | ||
* otherwise: '/home', | ||
* states: [homeState, aboutState] | ||
* }; | ||
* | ||
* @ NgModule({ | ||
* imports: [ | ||
* BrowserModule, | ||
* UIRouterModule.forRoot(routerConfig), | ||
* FeatureModule1 | ||
* ] | ||
* }) | ||
* class MyRootAppModule {} | ||
* | ||
* browserPlatformDynamic.bootstrapModule(MyRootAppModule); | ||
* ``` | ||
* | ||
* @param config declarative UI-Router configuration | ||
* @returns an `NgModule` which provides the [[UIRouter]] singleton instance | ||
*/ | ||
UIRouterModule.forRoot = /** | ||
* Creates a UI-Router Module for the root (bootstrapped) application module to import | ||
* | ||
* This factory function creates an [Angular NgModule](https://angular.io/docs/ts/latest/guide/ngmodule.html) | ||
* with UI-Router support. | ||
* | ||
* The `forRoot` module should be added to the `imports:` of the `NgModule` being bootstrapped. | ||
* An application should only create and import a single `NgModule` using `forRoot()`. | ||
* All other modules should be created using [[UIRouterModule.forChild]]. | ||
* | ||
* Unlike `forChild`, an `NgModule` returned by this factory provides the [[UIRouter]] singleton object. | ||
* This factory also accepts root-level router configuration. | ||
* These are the only differences between `forRoot` and `forChild`. | ||
* | ||
* Example: | ||
* ```js | ||
* let routerConfig = { | ||
* otherwise: '/home', | ||
* states: [homeState, aboutState] | ||
* }; | ||
* | ||
* @ NgModule({ | ||
* imports: [ | ||
* BrowserModule, | ||
* UIRouterModule.forRoot(routerConfig), | ||
* FeatureModule1 | ||
* ] | ||
* }) | ||
* class MyRootAppModule {} | ||
* | ||
* browserPlatformDynamic.bootstrapModule(MyRootAppModule); | ||
* ``` | ||
* | ||
* @param config declarative UI-Router configuration | ||
* @returns an `NgModule` which provides the [[UIRouter]] singleton instance | ||
*/ | ||
function (config) { | ||
if (config === void 0) { config = {}; } | ||
@@ -126,3 +214,51 @@ return { | ||
*/ | ||
UIRouterModule.forChild = function (module) { | ||
/** | ||
* Creates an `NgModule` for a UIRouter module | ||
* | ||
* This function creates an [Angular NgModule](https://angular.io/docs/ts/latest/guide/ngmodule.html) | ||
* with UI-Router support. | ||
* | ||
* #### Example: | ||
* ```js | ||
* var homeState = { name: 'home', url: '/home', component: Home }; | ||
* var aboutState = { name: 'about', url: '/about', component: About }; | ||
* | ||
* @ NgModule({ | ||
* imports: [ | ||
* UIRouterModule.forChild({ states: [ homeState, aboutState ] }), | ||
* SharedModule, | ||
* ], | ||
* declarations: [ Home, About ], | ||
* }) | ||
* export class AppModule {}; | ||
* ``` | ||
* | ||
* @param module UI-Router module options | ||
* @returns an `NgModule` | ||
*/ | ||
UIRouterModule.forChild = /** | ||
* Creates an `NgModule` for a UIRouter module | ||
* | ||
* This function creates an [Angular NgModule](https://angular.io/docs/ts/latest/guide/ngmodule.html) | ||
* with UI-Router support. | ||
* | ||
* #### Example: | ||
* ```js | ||
* var homeState = { name: 'home', url: '/home', component: Home }; | ||
* var aboutState = { name: 'about', url: '/about', component: About }; | ||
* | ||
* @ NgModule({ | ||
* imports: [ | ||
* UIRouterModule.forChild({ states: [ homeState, aboutState ] }), | ||
* SharedModule, | ||
* ], | ||
* declarations: [ Home, About ], | ||
* }) | ||
* export class AppModule {}; | ||
* ``` | ||
* | ||
* @param module UI-Router module options | ||
* @returns an `NgModule` | ||
*/ | ||
function (module) { | ||
if (module === void 0) { module = {}; } | ||
@@ -129,0 +265,0 @@ return { |
@@ -1,1 +0,1 @@ | ||
[{"__symbolic":"module","version":3,"metadata":{"UIROUTER_ROOT_MODULE":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"OpaqueToken"},"arguments":["UIRouter Root Module"]},"UIROUTER_MODULE_TOKEN":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"OpaqueToken"},"arguments":["UIRouter Module"]},"UIROUTER_STATES":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"OpaqueToken"},"arguments":["UIRouter States"]},"makeRootProviders":{"__symbolic":"function","parameters":["module"],"value":[{"provide":{"__symbolic":"reference","name":"UIROUTER_ROOT_MODULE"},"useValue":{"__symbolic":"reference","name":"module"},"multi":true},{"provide":{"__symbolic":"reference","name":"UIROUTER_MODULE_TOKEN"},"useValue":{"__symbolic":"reference","name":"module"},"multi":true},{"provide":{"__symbolic":"reference","module":"@angular/router","name":"ROUTES"},"useValue":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"module"},"member":"states"},"right":[]},"multi":true},{"provide":{"__symbolic":"reference","module":"@angular/core","name":"ANALYZE_FOR_ENTRY_COMPONENTS"},"useValue":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"module"},"member":"states"},"right":[]},"multi":true}]},"makeChildProviders":{"__symbolic":"function","parameters":["module"],"value":[{"provide":{"__symbolic":"reference","name":"UIROUTER_MODULE_TOKEN"},"useValue":{"__symbolic":"reference","name":"module"},"multi":true},{"provide":{"__symbolic":"reference","module":"@angular/router","name":"ROUTES"},"useValue":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"module"},"member":"states"},"right":[]},"multi":true},{"provide":{"__symbolic":"reference","module":"@angular/core","name":"ANALYZE_FOR_ENTRY_COMPONENTS"},"useValue":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"module"},"member":"states"},"right":[]},"multi":true}]},"locationStrategy":{"__symbolic":"function","parameters":["useHash"],"value":{"provide":{"__symbolic":"reference","module":"@angular/common","name":"LocationStrategy"},"useClass":{"__symbolic":"if","condition":{"__symbolic":"reference","name":"useHash"},"thenExpression":{"__symbolic":"reference","module":"@angular/common","name":"HashLocationStrategy"},"elseExpression":{"__symbolic":"reference","module":"@angular/common","name":"PathLocationStrategy"}}}},"UIRouterModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule"},"arguments":[{"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule"}],"declarations":[{"__symbolic":"reference","module":"./directives/directives","name":"_UIROUTER_DIRECTIVES"}],"exports":[{"__symbolic":"reference","module":"./directives/directives","name":"_UIROUTER_DIRECTIVES"}],"entryComponents":[{"__symbolic":"reference","module":"./directives/uiView","name":"UIView"}]}]}],"statics":{"forRoot":{"__symbolic":"function","parameters":["config"],"value":{"ngModule":{"__symbolic":"reference","name":"UIRouterModule"},"providers":[{"__symbolic":"reference","module":"./providers","name":"_UIROUTER_INSTANCE_PROVIDERS"},{"__symbolic":"reference","module":"./providers","name":"_UIROUTER_SERVICE_PROVIDERS"},{"__symbolic":"call","expression":{"__symbolic":"reference","name":"locationStrategy"},"arguments":[{"__symbolic":"select","expression":{"__symbolic":"reference","name":"config"},"member":"useHash"}]},{"__symbolic":"spread","expression":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"makeRootProviders"},"arguments":[{"__symbolic":"reference","name":"config"}]}}]},"defaults":[{}]},"forChild":{"__symbolic":"function","parameters":["module"],"value":{"ngModule":{"__symbolic":"reference","name":"UIRouterModule"},"providers":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"makeChildProviders"},"arguments":[{"__symbolic":"reference","name":"module"}]}},"defaults":[{}]}}},"RootModule":{"__symbolic":"interface"},"StatesModule":{"__symbolic":"interface"}}},{"__symbolic":"module","version":1,"metadata":{"UIROUTER_ROOT_MODULE":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"OpaqueToken"},"arguments":["UIRouter Root Module"]},"UIROUTER_MODULE_TOKEN":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"OpaqueToken"},"arguments":["UIRouter Module"]},"UIROUTER_STATES":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"OpaqueToken"},"arguments":["UIRouter States"]},"makeRootProviders":{"__symbolic":"function","parameters":["module"],"value":[{"provide":{"__symbolic":"reference","name":"UIROUTER_ROOT_MODULE"},"useValue":{"__symbolic":"reference","name":"module"},"multi":true},{"provide":{"__symbolic":"reference","name":"UIROUTER_MODULE_TOKEN"},"useValue":{"__symbolic":"reference","name":"module"},"multi":true},{"provide":{"__symbolic":"reference","module":"@angular/router","name":"ROUTES"},"useValue":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"module"},"member":"states"},"right":[]},"multi":true},{"provide":{"__symbolic":"reference","module":"@angular/core","name":"ANALYZE_FOR_ENTRY_COMPONENTS"},"useValue":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"module"},"member":"states"},"right":[]},"multi":true}]},"makeChildProviders":{"__symbolic":"function","parameters":["module"],"value":[{"provide":{"__symbolic":"reference","name":"UIROUTER_MODULE_TOKEN"},"useValue":{"__symbolic":"reference","name":"module"},"multi":true},{"provide":{"__symbolic":"reference","module":"@angular/router","name":"ROUTES"},"useValue":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"module"},"member":"states"},"right":[]},"multi":true},{"provide":{"__symbolic":"reference","module":"@angular/core","name":"ANALYZE_FOR_ENTRY_COMPONENTS"},"useValue":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"module"},"member":"states"},"right":[]},"multi":true}]},"locationStrategy":{"__symbolic":"function","parameters":["useHash"],"value":{"provide":{"__symbolic":"reference","module":"@angular/common","name":"LocationStrategy"},"useClass":{"__symbolic":"if","condition":{"__symbolic":"reference","name":"useHash"},"thenExpression":{"__symbolic":"reference","module":"@angular/common","name":"HashLocationStrategy"},"elseExpression":{"__symbolic":"reference","module":"@angular/common","name":"PathLocationStrategy"}}}},"UIRouterModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule"},"arguments":[{"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule"}],"declarations":[{"__symbolic":"reference","module":"./directives/directives","name":"_UIROUTER_DIRECTIVES"}],"exports":[{"__symbolic":"reference","module":"./directives/directives","name":"_UIROUTER_DIRECTIVES"}],"entryComponents":[{"__symbolic":"reference","module":"./directives/uiView","name":"UIView"}]}]}],"statics":{"forRoot":{"__symbolic":"function","parameters":["config"],"value":{"ngModule":{"__symbolic":"reference","name":"UIRouterModule"},"providers":[{"__symbolic":"reference","module":"./providers","name":"_UIROUTER_INSTANCE_PROVIDERS"},{"__symbolic":"reference","module":"./providers","name":"_UIROUTER_SERVICE_PROVIDERS"},{"__symbolic":"call","expression":{"__symbolic":"reference","name":"locationStrategy"},"arguments":[{"__symbolic":"select","expression":{"__symbolic":"reference","name":"config"},"member":"useHash"}]},{"__symbolic":"spread","expression":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"makeRootProviders"},"arguments":[{"__symbolic":"reference","name":"config"}]}}]},"defaults":[{}]},"forChild":{"__symbolic":"function","parameters":["module"],"value":{"ngModule":{"__symbolic":"reference","name":"UIRouterModule"},"providers":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"makeChildProviders"},"arguments":[{"__symbolic":"reference","name":"module"}]}},"defaults":[{}]}}},"RootModule":{"__symbolic":"interface"},"StatesModule":{"__symbolic":"interface"}}}] | ||
[{"__symbolic":"module","version":4,"metadata":{"UIROUTER_ROOT_MODULE":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken"},"arguments":["UIRouter Root Module"]},"UIROUTER_MODULE_TOKEN":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken"},"arguments":["UIRouter Module"]},"UIROUTER_STATES":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken"},"arguments":["UIRouter States"]},"onTransitionReady":{"__symbolic":"function"},"makeRootProviders":{"__symbolic":"function","parameters":["module"],"value":[{"provide":{"__symbolic":"reference","name":"UIROUTER_ROOT_MODULE"},"useValue":{"__symbolic":"reference","name":"module"},"multi":true},{"provide":{"__symbolic":"reference","name":"UIROUTER_MODULE_TOKEN"},"useValue":{"__symbolic":"reference","name":"module"},"multi":true},{"provide":{"__symbolic":"reference","module":"@angular/router","name":"ROUTES"},"useValue":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"module"},"member":"states"},"right":[]},"multi":true},{"provide":{"__symbolic":"reference","module":"@angular/core","name":"ANALYZE_FOR_ENTRY_COMPONENTS"},"useValue":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"module"},"member":"states"},"right":[]},"multi":true},{"provide":{"__symbolic":"reference","module":"@angular/core","name":"APP_INITIALIZER"},"useFactory":{"__symbolic":"reference","name":"onTransitionReady"},"deps":[{"__symbolic":"reference","module":"@uirouter/core","name":"TransitionService"},{"__symbolic":"reference","name":"UIROUTER_ROOT_MODULE"}],"multi":true}]},"makeChildProviders":{"__symbolic":"function","parameters":["module"],"value":[{"provide":{"__symbolic":"reference","name":"UIROUTER_MODULE_TOKEN"},"useValue":{"__symbolic":"reference","name":"module"},"multi":true},{"provide":{"__symbolic":"reference","module":"@angular/router","name":"ROUTES"},"useValue":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"module"},"member":"states"},"right":[]},"multi":true},{"provide":{"__symbolic":"reference","module":"@angular/core","name":"ANALYZE_FOR_ENTRY_COMPONENTS"},"useValue":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"module"},"member":"states"},"right":[]},"multi":true}]},"locationStrategy":{"__symbolic":"function","parameters":["useHash"],"value":{"provide":{"__symbolic":"reference","module":"@angular/common","name":"LocationStrategy"},"useClass":{"__symbolic":"if","condition":{"__symbolic":"reference","name":"useHash"},"thenExpression":{"__symbolic":"reference","module":"@angular/common","name":"HashLocationStrategy"},"elseExpression":{"__symbolic":"reference","module":"@angular/common","name":"PathLocationStrategy"}}}},"UIRouterModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule"},"arguments":[{"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule"}],"declarations":[{"__symbolic":"reference","module":"./directives/directives","name":"_UIROUTER_DIRECTIVES"}],"exports":[{"__symbolic":"reference","module":"./directives/directives","name":"_UIROUTER_DIRECTIVES"}],"entryComponents":[{"__symbolic":"reference","module":"./directives/uiView","name":"UIView"}]}]}],"statics":{"forRoot":{"__symbolic":"function","parameters":["config"],"value":{"ngModule":{"__symbolic":"reference","name":"UIRouterModule"},"providers":[{"__symbolic":"reference","module":"./providers","name":"_UIROUTER_INSTANCE_PROVIDERS"},{"__symbolic":"reference","module":"./providers","name":"_UIROUTER_SERVICE_PROVIDERS"},{"__symbolic":"call","expression":{"__symbolic":"reference","name":"locationStrategy"},"arguments":[{"__symbolic":"select","expression":{"__symbolic":"reference","name":"config"},"member":"useHash"}]},{"__symbolic":"spread","expression":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"makeRootProviders"},"arguments":[{"__symbolic":"reference","name":"config"}]}}]},"defaults":[{}]},"forChild":{"__symbolic":"function","parameters":["module"],"value":{"ngModule":{"__symbolic":"reference","name":"UIRouterModule"},"providers":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"makeChildProviders"},"arguments":[{"__symbolic":"reference","name":"module"}]}},"defaults":[{}]}}},"RootModule":{"__symbolic":"interface"},"StatesModule":{"__symbolic":"interface"}}}] |
{ | ||
"name": "@uirouter/angular", | ||
"description": "State-based routing for Angular", | ||
"version": "1.0.0-beta.7-SNAPSHOT.20170812", | ||
"version": "1.0.0-rc.0", | ||
"scripts": { | ||
"clean": "shx rm -rf lib lib-esm _bundles _dec", | ||
"clean": "shx rm -rf lib lib-esm _bundles _doc", | ||
"compile": "npm run clean && ngc", | ||
"bundle": "rollup -c && rollup -c --environment MINIFY", | ||
"fixmaps": "modify_sourcemap_paths", | ||
"build": "npm run compile && npm run bundle && npm run fixmaps", | ||
"release": "release", | ||
"fixmaps:lib": "tweak_sourcemap_paths -a --include 'lib/**/*.js.map' 'lib-esm/**/*.js.map'", | ||
"fixmaps:bundle": "tweak_sourcemap_paths -a --include '_bundles/**/*.js.map'", | ||
"build": "run-s compile bundle fixmaps:*", | ||
"release": "release --deps @uirouter/core", | ||
"travis": "npm run build && npm run noimplicitany && npm run test", | ||
@@ -19,4 +20,4 @@ "test": "karma start", | ||
"publishdocs": "npm run docs && node --harmony scripts/publishdocs.js", | ||
"prepare": "npm run build", | ||
"changelog": "update_changelog", | ||
"prepublishOnly": "npm run build", | ||
"changelog": "update_changelog --include-core", | ||
"artifacts": "artifact_tagging" | ||
@@ -52,3 +53,3 @@ }, | ||
"dependencies": { | ||
"@uirouter/core": "^5.0.5", | ||
"@uirouter/core": "5.0.11", | ||
"@uirouter/rx": "=0.4.1", | ||
@@ -73,3 +74,3 @@ "tslib": "^1.7.1" | ||
"@types/jquery": "^1.10.31", | ||
"@uirouter/publish-scripts": "^1.0.4", | ||
"@uirouter/publish-scripts": "2.0.3", | ||
"awesome-typescript-loader": "^3.1.2", | ||
@@ -114,2 +115,2 @@ "babel-core": "^6.22.1", | ||
} | ||
} | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 2 instances in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
2
0
739441
76
4902
+ Added@uirouter/core@5.0.11(transitive)
- Removed@uirouter/core@5.0.23(transitive)
Updated@uirouter/core@5.0.11