UNPKG

12.3 kBSource Map (JSON)View Raw
1{"version":3,"file":"router_outlet.js","sourceRoot":"","sources":["../../../../../modules/@angular/router-deprecated/src/directives/router_outlet.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,qBAA2I,eAAe,CAAC,CAAA;AAE3J,sBAA2C,iBAAiB,CAAC,CAAA;AAC7D,2BAA+B,sBAAsB,CAAC,CAAA;AACtD,qBAAiC,gBAAgB,CAAC,CAAA;AAClD,4BAA2D,gBAAgB,CAAC,CAAA;AAE5E,IAAY,OAAO,WAAM,oCAAoC,CAAC,CAAA;AAC9D,0CAA+B,wCAAwC,CAAC,CAAA;AACxE,IAAY,SAAS,WAAM,WAAW,CAAC,CAAA;AAEvC,IAAI,cAAc,GAAG,sBAAc,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAElD;;;;;;;;GAQG;AAEH;IAOE,sBACY,iBAAmC,EAAU,OAA+B,EAC5E,aAA+B,EAAqB,QAAgB;QADpE,sBAAiB,GAAjB,iBAAiB,CAAkB;QAAU,YAAO,GAAP,OAAO,CAAwB;QAC5E,kBAAa,GAAb,aAAa,CAAkB;QAR3C,SAAI,GAAW,IAAI,CAAC;QACZ,kBAAa,GAA+B,IAAI,CAAC;QACjD,wBAAmB,GAAyB,IAAI,CAAC;QAE9B,mBAAc,GAAG,IAAI,oBAAY,EAAO,CAAC;QAKlE,EAAE,CAAC,CAAC,gBAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;YACxB,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC;YACrB,IAAI,CAAC,aAAa,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;QAC7C,CAAC;QAAC,IAAI,CAAC,CAAC;YACN,IAAI,CAAC,aAAa,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC;QACjD,CAAC;IACH,CAAC;IAED;;;OAGG;IACH,+BAAQ,GAAR,UAAS,eAAqC;QAA9C,iBAuBC;QAtBC,IAAI,mBAAmB,GAAG,IAAI,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C,aAAa,CAAC,CAAC,CAAC,CAAC;YAC5F,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,CAC5B,UAAC,GAAsB;gBACnB,OAAW,GAAG,CAAC,QAAS,CAAC,cAAc,CAAC,eAAe,EAAE,KAAI,CAAC,mBAAmB,CAAC;YAAlF,CAAkF,CAAC,CAAC;QAC9F,CAAC;QAAC,IAAI,CAAC,CAAC;YACN,MAAM,GAAG,eAAe,IAAI,IAAI,CAAC,mBAAmB;gBAChD,CAAC,gBAAS,CAAC,eAAe,CAAC,MAAM,CAAC,IAAI,gBAAS,CAAC,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC;oBAC/E,6BAAgB,CAAC,MAAM,CAAC,eAAe,CAAC,MAAM,EAAE,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAC;QACzF,CAAC;QACD,MAAM,CAAmB,sBAAc,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC1D,CAAC;IAED,kCAAW,GAAX,cAAsB,IAAI,CAAC,aAAa,CAAC,uBAAuB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IA1IzE;QAAC,aAAM,CAAC,UAAU,CAAC;;wDAAA;IANrB;QAAC,gBAAS,CAAC,EAAC,QAAQ,EAAE,eAAe,EAAC,CAAC;mBAUS,gBAAS,CAAC,MAAM,CAAC;2GAA1B,MAAM;oBAVN;IAiJvC,mBAAC;AAAD,CAAC,AAhJD,IAgJC;AAhJY,oBAAY,eAgJxB,CAAA","sourcesContent":["import {Attribute, ComponentRef, Directive, DynamicComponentLoader, OnDestroy, Output, ReflectiveInjector, ViewContainerRef, provide} from '@angular/core';\n\nimport {EventEmitter, PromiseWrapper} from '../facade/async';\nimport {StringMapWrapper} from '../facade/collection';\nimport {isBlank, isPresent} from '../facade/lang';\nimport {ComponentInstruction, RouteData, RouteParams} from '../instruction';\nimport {CanDeactivate, CanReuse, OnActivate, OnDeactivate, OnReuse} from '../interfaces';\nimport * as hookMod from '../lifecycle/lifecycle_annotations';\nimport {hasLifecycleHook} from '../lifecycle/route_lifecycle_reflector';\nimport * as routerMod from '../router';\n\nlet _resolveToTrue = PromiseWrapper.resolve(true);\n\n/**\n * A router outlet is a placeholder that Angular dynamically fills based on the application's route.\n *\n * ## Use\n *\n * ```\n * <router-outlet></router-outlet>\n * ```\n */\n@Directive({selector: 'router-outlet'})\nexport class RouterOutlet implements OnDestroy {\n name: string = null;\n private _componentRef: Promise<ComponentRef<any>> = null;\n private _currentInstruction: ComponentInstruction = null;\n\n @Output('activate') public activateEvents = new EventEmitter<any>();\n\n constructor(\n private _viewContainerRef: ViewContainerRef, private _loader: DynamicComponentLoader,\n private _parentRouter: routerMod.Router, @Attribute('name') nameAttr: string) {\n if (isPresent(nameAttr)) {\n this.name = nameAttr;\n this._parentRouter.registerAuxOutlet(this);\n } else {\n this._parentRouter.registerPrimaryOutlet(this);\n }\n }\n\n /**\n * Called by the Router to instantiate a new component during the commit phase of a navigation.\n * This method in turn is responsible for calling the `routerOnActivate` hook of its child.\n */\n activate(nextInstruction: ComponentInstruction): Promise<any> {\n var previousInstruction = this._currentInstruction;\n this._currentInstruction = nextInstruction;\n var componentType = nextInstruction.componentType;\n var childRouter = this._parentRouter.childRouter(componentType);\n\n var providers = ReflectiveInjector.resolve([\n {provide: RouteData, useValue: nextInstruction.routeData},\n {provide: RouteParams, useValue: new RouteParams(nextInstruction.params)},\n {provide: routerMod.Router, useValue: childRouter}\n ]);\n this._componentRef =\n this._loader.loadNextToLocation(componentType, this._viewContainerRef, providers);\n return this._componentRef.then((componentRef) => {\n this.activateEvents.emit(componentRef.instance);\n if (hasLifecycleHook(hookMod.routerOnActivate, componentType)) {\n return this._componentRef.then(\n (ref: ComponentRef<any>) =>\n (<OnActivate>ref.instance).routerOnActivate(nextInstruction, previousInstruction));\n } else {\n return componentRef;\n }\n });\n }\n\n /**\n * Called by the {@link Router} during the commit phase of a navigation when an outlet\n * reuses a component between different routes.\n * This method in turn is responsible for calling the `routerOnReuse` hook of its child.\n */\n reuse(nextInstruction: ComponentInstruction): Promise<any> {\n var previousInstruction = this._currentInstruction;\n this._currentInstruction = nextInstruction;\n\n // it's possible the component is removed before it can be reactivated (if nested withing\n // another dynamically loaded component, for instance). In that case, we simply activate\n // a new one.\n if (isBlank(this._componentRef)) {\n return this.activate(nextInstruction);\n } else {\n return PromiseWrapper.resolve(\n hasLifecycleHook(hookMod.routerOnReuse, this._currentInstruction.componentType) ?\n this._componentRef.then(\n (ref: ComponentRef<any>) =>\n (<OnReuse>ref.instance).routerOnReuse(nextInstruction, previousInstruction)) :\n true);\n }\n }\n\n /**\n * Called by the {@link Router} when an outlet disposes of a component's contents.\n * This method in turn is responsible for calling the `routerOnDeactivate` hook of its child.\n */\n deactivate(nextInstruction: ComponentInstruction): Promise<any> {\n var next = _resolveToTrue;\n if (isPresent(this._componentRef) && isPresent(this._currentInstruction) &&\n hasLifecycleHook(hookMod.routerOnDeactivate, this._currentInstruction.componentType)) {\n next = this._componentRef.then(\n (ref: ComponentRef<any>) =>\n (<OnDeactivate>ref.instance)\n .routerOnDeactivate(nextInstruction, this._currentInstruction));\n }\n return next.then((_) => {\n if (isPresent(this._componentRef)) {\n var onDispose = this._componentRef.then((ref: ComponentRef<any>) => ref.destroy());\n this._componentRef = null;\n return onDispose;\n }\n });\n }\n\n /**\n * Called by the {@link Router} during recognition phase of a navigation.\n *\n * If this resolves to `false`, the given navigation is cancelled.\n *\n * This method delegates to the child component's `routerCanDeactivate` hook if it exists,\n * and otherwise resolves to true.\n */\n routerCanDeactivate(nextInstruction: ComponentInstruction): Promise<boolean> {\n if (isBlank(this._currentInstruction)) {\n return _resolveToTrue;\n }\n if (hasLifecycleHook(hookMod.routerCanDeactivate, this._currentInstruction.componentType)) {\n return this._componentRef.then(\n (ref: ComponentRef<any>) =>\n (<CanDeactivate>ref.instance)\n .routerCanDeactivate(nextInstruction, this._currentInstruction));\n } else {\n return _resolveToTrue;\n }\n }\n\n /**\n * Called by the {@link Router} during recognition phase of a navigation.\n *\n * If the new child component has a different Type than the existing child component,\n * this will resolve to `false`. You can't reuse an old component when the new component\n * is of a different Type.\n *\n * Otherwise, this method delegates to the child component's `routerCanReuse` hook if it exists,\n * or resolves to true if the hook is not present.\n */\n routerCanReuse(nextInstruction: ComponentInstruction): Promise<boolean> {\n var result: any /** TODO #9100 */;\n\n if (isBlank(this._currentInstruction) ||\n this._currentInstruction.componentType != nextInstruction.componentType) {\n result = false;\n } else if (hasLifecycleHook(hookMod.routerCanReuse, this._currentInstruction.componentType)) {\n result = this._componentRef.then(\n (ref: ComponentRef<any>) =>\n (<CanReuse>ref.instance).routerCanReuse(nextInstruction, this._currentInstruction));\n } else {\n result = nextInstruction == this._currentInstruction ||\n (isPresent(nextInstruction.params) && isPresent(this._currentInstruction.params) &&\n StringMapWrapper.equals(nextInstruction.params, this._currentInstruction.params));\n }\n return <Promise<boolean>>PromiseWrapper.resolve(result);\n }\n\n ngOnDestroy(): void { this._parentRouter.unregisterPrimaryOutlet(this); }\n}\n"]}
\No newline at end of file