| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013 |
- /**
- * @license Angular v8.1.0
- * (c) 2010-2019 Google LLC. https://angular.io/
- * License: MIT
- */
- import { AfterContentInit } from '@angular/core';
- import { ApplicationRef } from '@angular/core';
- import { ChangeDetectorRef } from '@angular/core';
- import { Compiler } from '@angular/core';
- import { ComponentFactoryResolver } from '@angular/core';
- import { ComponentRef } from '@angular/core';
- import { ElementRef } from '@angular/core';
- import { EventEmitter } from '@angular/core';
- import { HashLocationStrategy } from '@angular/common';
- import { InjectionToken } from '@angular/core';
- import { Injector } from '@angular/core';
- import { Location } from '@angular/common';
- import { LocationStrategy } from '@angular/common';
- import { ModuleWithProviders } from '@angular/core';
- import { NgModuleFactory } from '@angular/core';
- import { NgModuleFactoryLoader } from '@angular/core';
- import { NgProbeToken } from '@angular/core';
- import { Observable } from 'rxjs';
- import { OnChanges } from '@angular/core';
- import { OnDestroy } from '@angular/core';
- import { OnInit } from '@angular/core';
- import { PathLocationStrategy } from '@angular/common';
- import { PlatformLocation } from '@angular/common';
- import { Provider } from '@angular/core';
- import { QueryList } from '@angular/core';
- import { Renderer2 } from '@angular/core';
- import { SimpleChanges } from '@angular/core';
- import { Type } from '@angular/core';
- import { Version } from '@angular/core';
- import { ViewContainerRef } from '@angular/core';
- import { ViewportScroller } from '@angular/common';
- /**
- * @description
- *
- * Contains the information about a route associated with a component loaded in an
- * outlet. An `ActivatedRoute` can also be used to traverse the router state tree.
- *
- * {@example router/activated-route/module.ts region="activated-route"
- * header="activated-route.component.ts" linenums="false"}
- *
- * @publicApi
- */
- export declare class ActivatedRoute {
- /** An observable of the URL segments matched by this route */
- url: Observable<UrlSegment[]>;
- /** An observable of the matrix parameters scoped to this route */
- params: Observable<Params>;
- /** An observable of the query parameters shared by all the routes */
- queryParams: Observable<Params>;
- /** An observable of the URL fragment shared by all the routes */
- fragment: Observable<string>;
- /** An observable of the static and resolved data of this route. */
- data: Observable<Data>;
- /** The outlet name of the route. It's a constant */
- outlet: string;
- /** The component of the route. It's a constant */
- component: Type<any> | string | null;
- /** The current snapshot of this route */
- snapshot: ActivatedRouteSnapshot;
- /** The configuration used to match this route */
- readonly routeConfig: Route | null;
- /** The root of the router state */
- readonly root: ActivatedRoute;
- /** The parent of this route in the router state tree */
- readonly parent: ActivatedRoute | null;
- /** The first child of this route in the router state tree */
- readonly firstChild: ActivatedRoute | null;
- /** The children of this route in the router state tree */
- readonly children: ActivatedRoute[];
- /** The path from the root of the router state tree to this route */
- readonly pathFromRoot: ActivatedRoute[];
- readonly paramMap: Observable<ParamMap>;
- readonly queryParamMap: Observable<ParamMap>;
- toString(): string;
- }
- /**
- * @description
- *
- * Contains the information about a route associated with a component loaded in an
- * outlet at a particular moment in time. ActivatedRouteSnapshot can also be used to
- * traverse the router state tree.
- *
- * ```
- * @Component({templateUrl:'./my-component.html'})
- * class MyComponent {
- * constructor(route: ActivatedRoute) {
- * const id: string = route.snapshot.params.id;
- * const url: string = route.snapshot.url.join('');
- * const user = route.snapshot.data.user;
- * }
- * }
- * ```
- *
- * @publicApi
- */
- export declare class ActivatedRouteSnapshot {
- /** The URL segments matched by this route */
- url: UrlSegment[];
- /** The matrix parameters scoped to this route */
- params: Params;
- /** The query parameters shared by all the routes */
- queryParams: Params;
- /** The URL fragment shared by all the routes */
- fragment: string;
- /** The static and resolved data of this route */
- data: Data;
- /** The outlet name of the route */
- outlet: string;
- /** The component of the route */
- component: Type<any> | string | null;
- /** The configuration used to match this route **/
- readonly routeConfig: Route | null;
- /** The root of the router state */
- readonly root: ActivatedRouteSnapshot;
- /** The parent of this route in the router state tree */
- readonly parent: ActivatedRouteSnapshot | null;
- /** The first child of this route in the router state tree */
- readonly firstChild: ActivatedRouteSnapshot | null;
- /** The children of this route in the router state tree */
- readonly children: ActivatedRouteSnapshot[];
- /** The path from the root of the router state tree to this route */
- readonly pathFromRoot: ActivatedRouteSnapshot[];
- readonly paramMap: ParamMap;
- readonly queryParamMap: ParamMap;
- toString(): string;
- }
- /**
- * @description
- *
- * Represents the start of end of the Resolve phase of routing. See note on
- * `ActivationStart` for use of this experimental API.
- *
- * @publicApi
- */
- export declare class ActivationEnd {
- /** @docsNotRequired */
- snapshot: ActivatedRouteSnapshot;
- constructor(
- /** @docsNotRequired */
- snapshot: ActivatedRouteSnapshot);
- toString(): string;
- }
- /**
- * @description
- *
- * Represents the start of end of the Resolve phase of routing. See note on
- * `ActivationEnd` for use of this experimental API.
- *
- * @publicApi
- */
- export declare class ActivationStart {
- /** @docsNotRequired */
- snapshot: ActivatedRouteSnapshot;
- constructor(
- /** @docsNotRequired */
- snapshot: ActivatedRouteSnapshot);
- toString(): string;
- }
- /**
- * @description
- *
- * Interface that a class can implement to be a guard deciding if a route can be activated.
- * If all guards return `true`, navigation will continue. If any guard returns `false`,
- * navigation will be cancelled. If any guard returns a `UrlTree`, current navigation will
- * be cancelled and a new navigation will be kicked off to the `UrlTree` returned from the
- * guard.
- *
- * ```
- * class UserToken {}
- * class Permissions {
- * canActivate(user: UserToken, id: string): boolean {
- * return true;
- * }
- * }
- *
- * @Injectable()
- * class CanActivateTeam implements CanActivate {
- * constructor(private permissions: Permissions, private currentUser: UserToken) {}
- *
- * canActivate(
- * route: ActivatedRouteSnapshot,
- * state: RouterStateSnapshot
- * ): Observable<boolean|UrlTree>|Promise<boolean|UrlTree>|boolean|UrlTree {
- * return this.permissions.canActivate(this.currentUser, route.params.id);
- * }
- * }
- *
- * @NgModule({
- * imports: [
- * RouterModule.forRoot([
- * {
- * path: 'team/:id',
- * component: TeamComponent,
- * canActivate: [CanActivateTeam]
- * }
- * ])
- * ],
- * providers: [CanActivateTeam, UserToken, Permissions]
- * })
- * class AppModule {}
- * ```
- *
- * You can alternatively provide a function with the `canActivate` signature:
- *
- * ```
- * @NgModule({
- * imports: [
- * RouterModule.forRoot([
- * {
- * path: 'team/:id',
- * component: TeamComponent,
- * canActivate: ['canActivateTeam']
- * }
- * ])
- * ],
- * providers: [
- * {
- * provide: 'canActivateTeam',
- * useValue: (route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => true
- * }
- * ]
- * })
- * class AppModule {}
- * ```
- *
- * @publicApi
- */
- export declare interface CanActivate {
- canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree;
- }
- /**
- * @description
- *
- * Interface that a class can implement to be a guard deciding if a child route can be activated.
- * If all guards return `true`, navigation will continue. If any guard returns `false`,
- * navigation will be cancelled. If any guard returns a `UrlTree`, current navigation will
- * be cancelled and a new navigation will be kicked off to the `UrlTree` returned from the
- * guard.
- *
- * ```
- * class UserToken {}
- * class Permissions {
- * canActivate(user: UserToken, id: string): boolean {
- * return true;
- * }
- * }
- *
- * @Injectable()
- * class CanActivateTeam implements CanActivateChild {
- * constructor(private permissions: Permissions, private currentUser: UserToken) {}
- *
- * canActivateChild(
- * route: ActivatedRouteSnapshot,
- * state: RouterStateSnapshot
- * ): Observable<boolean|UrlTree>|Promise<boolean|UrlTree>|boolean|UrlTree {
- * return this.permissions.canActivate(this.currentUser, route.params.id);
- * }
- * }
- *
- * @NgModule({
- * imports: [
- * RouterModule.forRoot([
- * {
- * path: 'root',
- * canActivateChild: [CanActivateTeam],
- * children: [
- * {
- * path: 'team/:id',
- * component: TeamComponent
- * }
- * ]
- * }
- * ])
- * ],
- * providers: [CanActivateTeam, UserToken, Permissions]
- * })
- * class AppModule {}
- * ```
- *
- * You can alternatively provide a function with the `canActivateChild` signature:
- *
- * ```
- * @NgModule({
- * imports: [
- * RouterModule.forRoot([
- * {
- * path: 'root',
- * canActivateChild: ['canActivateTeam'],
- * children: [
- * {
- * path: 'team/:id',
- * component: TeamComponent
- * }
- * ]
- * }
- * ])
- * ],
- * providers: [
- * {
- * provide: 'canActivateTeam',
- * useValue: (route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => true
- * }
- * ]
- * })
- * class AppModule {}
- * ```
- *
- * @publicApi
- */
- export declare interface CanActivateChild {
- canActivateChild(childRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree;
- }
- /**
- * @description
- *
- * Interface that a class can implement to be a guard deciding if a route can be deactivated.
- * If all guards return `true`, navigation will continue. If any guard returns `false`,
- * navigation will be cancelled. If any guard returns a `UrlTree`, current navigation will
- * be cancelled and a new navigation will be kicked off to the `UrlTree` returned from the
- * guard.
- *
- * ```
- * class UserToken {}
- * class Permissions {
- * canDeactivate(user: UserToken, id: string): boolean {
- * return true;
- * }
- * }
- *
- * @Injectable()
- * class CanDeactivateTeam implements CanDeactivate<TeamComponent> {
- * constructor(private permissions: Permissions, private currentUser: UserToken) {}
- *
- * canDeactivate(
- * component: TeamComponent,
- * currentRoute: ActivatedRouteSnapshot,
- * currentState: RouterStateSnapshot,
- * nextState: RouterStateSnapshot
- * ): Observable<boolean|UrlTree>|Promise<boolean|UrlTree>|boolean|UrlTree {
- * return this.permissions.canDeactivate(this.currentUser, route.params.id);
- * }
- * }
- *
- * @NgModule({
- * imports: [
- * RouterModule.forRoot([
- * {
- * path: 'team/:id',
- * component: TeamComponent,
- * canDeactivate: [CanDeactivateTeam]
- * }
- * ])
- * ],
- * providers: [CanDeactivateTeam, UserToken, Permissions]
- * })
- * class AppModule {}
- * ```
- *
- * You can alternatively provide a function with the `canDeactivate` signature:
- *
- * ```
- * @NgModule({
- * imports: [
- * RouterModule.forRoot([
- * {
- * path: 'team/:id',
- * component: TeamComponent,
- * canDeactivate: ['canDeactivateTeam']
- * }
- * ])
- * ],
- * providers: [
- * {
- * provide: 'canDeactivateTeam',
- * useValue: (component: TeamComponent, currentRoute: ActivatedRouteSnapshot, currentState:
- * RouterStateSnapshot, nextState: RouterStateSnapshot) => true
- * }
- * ]
- * })
- * class AppModule {}
- * ```
- *
- * @publicApi
- */
- export declare interface CanDeactivate<T> {
- canDeactivate(component: T, currentRoute: ActivatedRouteSnapshot, currentState: RouterStateSnapshot, nextState?: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree;
- }
- /**
- * @description
- *
- * Interface that a class can implement to be a guard deciding if children can be loaded.
- *
- * ```
- * class UserToken {}
- * class Permissions {
- * canLoadChildren(user: UserToken, id: string, segments: UrlSegment[]): boolean {
- * return true;
- * }
- * }
- *
- * @Injectable()
- * class CanLoadTeamSection implements CanLoad {
- * constructor(private permissions: Permissions, private currentUser: UserToken) {}
- *
- * canLoad(route: Route, segments: UrlSegment[]): Observable<boolean>|Promise<boolean>|boolean {
- * return this.permissions.canLoadChildren(this.currentUser, route, segments);
- * }
- * }
- *
- * @NgModule({
- * imports: [
- * RouterModule.forRoot([
- * {
- * path: 'team/:id',
- * component: TeamComponent,
- * loadChildren: 'team.js',
- * canLoad: [CanLoadTeamSection]
- * }
- * ])
- * ],
- * providers: [CanLoadTeamSection, UserToken, Permissions]
- * })
- * class AppModule {}
- * ```
- *
- * You can alternatively provide a function with the `canLoad` signature:
- *
- * ```
- * @NgModule({
- * imports: [
- * RouterModule.forRoot([
- * {
- * path: 'team/:id',
- * component: TeamComponent,
- * loadChildren: 'team.js',
- * canLoad: ['canLoadTeamSection']
- * }
- * ])
- * ],
- * providers: [
- * {
- * provide: 'canLoadTeamSection',
- * useValue: (route: Route, segments: UrlSegment[]) => true
- * }
- * ]
- * })
- * class AppModule {}
- * ```
- *
- * @publicApi
- */
- export declare interface CanLoad {
- canLoad(route: Route, segments: UrlSegment[]): Observable<boolean> | Promise<boolean> | boolean;
- }
- /**
- * @description
- *
- * Represents the start of end of the Resolve phase of routing. See note on
- * `ChildActivationStart` for use of this experimental API.
- *
- * @publicApi
- */
- export declare class ChildActivationEnd {
- /** @docsNotRequired */
- snapshot: ActivatedRouteSnapshot;
- constructor(
- /** @docsNotRequired */
- snapshot: ActivatedRouteSnapshot);
- toString(): string;
- }
- /**
- * @description
- *
- * Represents the start of end of the Resolve phase of routing. See note on
- * `ChildActivationEnd` for use of this experimental API.
- *
- * @publicApi
- */
- export declare class ChildActivationStart {
- /** @docsNotRequired */
- snapshot: ActivatedRouteSnapshot;
- constructor(
- /** @docsNotRequired */
- snapshot: ActivatedRouteSnapshot);
- toString(): string;
- }
- /**
- * Store contextual information about the children (= nested) `RouterOutlet`
- *
- * @publicApi
- */
- export declare class ChildrenOutletContexts {
- private contexts;
- /** Called when a `RouterOutlet` directive is instantiated */
- onChildOutletCreated(childName: string, outlet: RouterOutlet): void;
- /**
- * Called when a `RouterOutlet` directive is destroyed.
- * We need to keep the context as the outlet could be destroyed inside a NgIf and might be
- * re-created later.
- */
- onChildOutletDestroyed(childName: string): void;
- /**
- * Called when the corresponding route is deactivated during navigation.
- * Because the component get destroyed, all children outlet are destroyed.
- */
- onOutletDeactivated(): Map<string, OutletContext>;
- onOutletReAttached(contexts: Map<string, OutletContext>): void;
- getOrCreateContext(childName: string): OutletContext;
- getContext(childName: string): OutletContext | null;
- }
- /**
- * Convert a `Params` instance to a `ParamMap`.
- *
- * @publicApi
- */
- export declare function convertToParamMap(params: Params): ParamMap;
- /**
- *
- * Represents static data associated with a particular route.
- *
- * @see `Route#data`
- *
- * @publicApi
- */
- export declare type Data = {
- [name: string]: any;
- };
- /**
- * @description
- *
- * A default implementation of the `UrlSerializer`.
- *
- * Example URLs:
- *
- * ```
- * /inbox/33(popup:compose)
- * /inbox/33;open=true/messages/44
- * ```
- *
- * DefaultUrlSerializer uses parentheses to serialize secondary segments (e.g., popup:compose), the
- * colon syntax to specify the outlet, and the ';parameter=value' syntax (e.g., open=true) to
- * specify route specific parameters.
- *
- * @publicApi
- */
- export declare class DefaultUrlSerializer implements UrlSerializer {
- /** Parses a url into a `UrlTree` */
- parse(url: string): UrlTree;
- /** Converts a `UrlTree` into a url */
- serialize(tree: UrlTree): string;
- }
- /**
- * A string of the form `path/to/file#exportName` that acts as a URL for a set of routes to load.
- *
- * @see `Route#loadChildren`
- * @publicApi
- * @deprecated the `string` form of `loadChildren` is deprecated in favor of the proposed ES dynamic
- * `import()` expression, which offers a more natural and standards-based mechanism to dynamically
- * load an ES module at runtime.
- */
- export declare type DeprecatedLoadChildren = string;
- /**
- * @description
- *
- * Represents the detached route tree.
- *
- * This is an opaque value the router will give to a custom route reuse strategy
- * to store and retrieve later on.
- *
- * @publicApi
- */
- export declare type DetachedRouteHandle = {};
- /**
- * @description
- *
- * Error handler that is invoked when a navigation errors.
- *
- * If the handler returns a value, the navigation promise will be resolved with this value.
- * If the handler throws an exception, the navigation promise will be rejected with
- * the exception.
- *
- * @publicApi
- */
- declare type ErrorHandler = (error: any) => any;
- /**
- * @description
- *
- * Represents a router event, allowing you to track the lifecycle of the router.
- *
- * The sequence of router events is:
- *
- * - `NavigationStart`,
- * - `RouteConfigLoadStart`,
- * - `RouteConfigLoadEnd`,
- * - `RoutesRecognized`,
- * - `GuardsCheckStart`,
- * - `ChildActivationStart`,
- * - `ActivationStart`,
- * - `GuardsCheckEnd`,
- * - `ResolveStart`,
- * - `ResolveEnd`,
- * - `ActivationEnd`
- * - `ChildActivationEnd`
- * - `NavigationEnd`,
- * - `NavigationCancel`,
- * - `NavigationError`
- * - `Scroll`
- *
- * @publicApi
- */
- export declare type Event = RouterEvent | RouteConfigLoadStart | RouteConfigLoadEnd | ChildActivationStart | ChildActivationEnd | ActivationStart | ActivationEnd | Scroll;
- /**
- * @description
- *
- * Represents options to configure the router.
- *
- * @publicApi
- */
- export declare interface ExtraOptions {
- /**
- * Makes the router log all its internal events to the console.
- */
- enableTracing?: boolean;
- /**
- * Enables the location strategy that uses the URL fragment instead of the history API.
- */
- useHash?: boolean;
- /**
- * Disables the initial navigation.
- */
- initialNavigation?: InitialNavigation;
- /**
- * A custom error handler.
- */
- errorHandler?: ErrorHandler;
- /**
- * Configures a preloading strategy. See `PreloadAllModules`.
- */
- preloadingStrategy?: any;
- /**
- * Define what the router should do if it receives a navigation request to the current URL.
- * By default, the router will ignore this navigation. However, this prevents features such
- * as a "refresh" button. Use this option to configure the behavior when navigating to the
- * current URL. Default is 'ignore'.
- */
- onSameUrlNavigation?: 'reload' | 'ignore';
- /**
- * Configures if the scroll position needs to be restored when navigating back.
- *
- * * 'disabled'--does nothing (default). Scroll position will be maintained on navigation.
- * * 'top'--set the scroll position to x = 0, y = 0 on all navigation.
- * * 'enabled'--restores the previous scroll position on backward navigation, else sets the
- * position to the anchor if one is provided, or sets the scroll position to [0, 0] (forward
- * navigation). This option will be the default in the future.
- *
- * You can implement custom scroll restoration behavior by adapting the enabled behavior as
- * follows:
- * ```typescript
- * class AppModule {
- * constructor(router: Router, viewportScroller: ViewportScroller) {
- * router.events.pipe(
- * filter((e: Event): e is Scroll => e instanceof Scroll)
- * ).subscribe(e => {
- * if (e.position) {
- * // backward navigation
- * viewportScroller.scrollToPosition(e.position);
- * } else if (e.anchor) {
- * // anchor navigation
- * viewportScroller.scrollToAnchor(e.anchor);
- * } else {
- * // forward navigation
- * viewportScroller.scrollToPosition([0, 0]);
- * }
- * });
- * }
- * }
- * ```
- */
- scrollPositionRestoration?: 'disabled' | 'enabled' | 'top';
- /**
- * Configures if the router should scroll to the element when the url has a fragment.
- *
- * * 'disabled'--does nothing (default).
- * * 'enabled'--scrolls to the element. This option will be the default in the future.
- *
- * Anchor scrolling does not happen on 'popstate'. Instead, we restore the position
- * that we stored or scroll to the top.
- */
- anchorScrolling?: 'disabled' | 'enabled';
- /**
- * Configures the scroll offset the router will use when scrolling to an element.
- *
- * When given a tuple with two numbers, the router will always use the numbers.
- * When given a function, the router will invoke the function every time it restores scroll
- * position.
- */
- scrollOffset?: [number, number] | (() => [number, number]);
- /**
- * Defines how the router merges params, data and resolved data from parent to child
- * routes. Available options are:
- *
- * - `'emptyOnly'`, the default, only inherits parent params for path-less or component-less
- * routes.
- * - `'always'`, enables unconditional inheritance of parent params.
- */
- paramsInheritanceStrategy?: 'emptyOnly' | 'always';
- /**
- * A custom malformed uri error handler function. This handler is invoked when encodedURI contains
- * invalid character sequences. The default implementation is to redirect to the root url dropping
- * any path or param info. This function passes three parameters:
- *
- * - `'URIError'` - Error thrown when parsing a bad URL
- * - `'UrlSerializer'` - UrlSerializer that’s configured with the router.
- * - `'url'` - The malformed URL that caused the URIError
- * */
- malformedUriErrorHandler?: (error: URIError, urlSerializer: UrlSerializer, url: string) => UrlTree;
- /**
- * Defines when the router updates the browser URL. The default behavior is to update after
- * successful navigation. However, some applications may prefer a mode where the URL gets
- * updated at the beginning of navigation. The most common use case would be updating the
- * URL early so if navigation fails, you can show an error message with the URL that failed.
- * Available options are:
- *
- * - `'deferred'`, the default, updates the browser URL after navigation has finished.
- * - `'eager'`, updates browser URL at the beginning of navigation.
- */
- urlUpdateStrategy?: 'deferred' | 'eager';
- /**
- * Enables a bug fix that corrects relative link resolution in components with empty paths.
- * Example:
- *
- * ```
- * const routes = [
- * {
- * path: '',
- * component: ContainerComponent,
- * children: [
- * { path: 'a', component: AComponent },
- * { path: 'b', component: BComponent },
- * ]
- * }
- * ];
- * ```
- *
- * From the `ContainerComponent`, this will not work:
- *
- * `<a [routerLink]="['./a']">Link to A</a>`
- *
- * However, this will work:
- *
- * `<a [routerLink]="['../a']">Link to A</a>`
- *
- * In other words, you're required to use `../` rather than `./`. This is currently the default
- * behavior. Setting this option to `corrected` enables the fix.
- */
- relativeLinkResolution?: 'legacy' | 'corrected';
- }
- /**
- * @description
- *
- * Represents the end of the Guard phase of routing.
- *
- * @publicApi
- */
- export declare class GuardsCheckEnd extends RouterEvent {
- /** @docsNotRequired */
- urlAfterRedirects: string;
- /** @docsNotRequired */
- state: RouterStateSnapshot;
- /** @docsNotRequired */
- shouldActivate: boolean;
- constructor(
- /** @docsNotRequired */
- id: number,
- /** @docsNotRequired */
- url: string,
- /** @docsNotRequired */
- urlAfterRedirects: string,
- /** @docsNotRequired */
- state: RouterStateSnapshot,
- /** @docsNotRequired */
- shouldActivate: boolean);
- toString(): string;
- }
- /**
- * @description
- *
- * Represents the start of the Guard phase of routing.
- *
- * @publicApi
- */
- export declare class GuardsCheckStart extends RouterEvent {
- /** @docsNotRequired */
- urlAfterRedirects: string;
- /** @docsNotRequired */
- state: RouterStateSnapshot;
- constructor(
- /** @docsNotRequired */
- id: number,
- /** @docsNotRequired */
- url: string,
- /** @docsNotRequired */
- urlAfterRedirects: string,
- /** @docsNotRequired */
- state: RouterStateSnapshot);
- toString(): string;
- }
- /**
- * @description
- *
- * Represents an option to configure when the initial navigation is performed.
- *
- * * 'enabled' - the initial navigation starts before the root component is created.
- * The bootstrap is blocked until the initial navigation is complete.
- * * 'disabled' - the initial navigation is not performed. The location listener is set up before
- * the root component gets created.
- * * 'legacy_enabled'- the initial navigation starts after the root component has been created.
- * The bootstrap is not blocked until the initial navigation is complete. @deprecated
- * * 'legacy_disabled'- the initial navigation is not performed. The location listener is set up
- * after @deprecated
- * the root component gets created.
- * * `true` - same as 'legacy_enabled'. @deprecated since v4
- * * `false` - same as 'legacy_disabled'. @deprecated since v4
- *
- * The 'enabled' option should be used for applications unless there is a reason to have
- * more control over when the router starts its initial navigation due to some complex
- * initialization logic. In this case, 'disabled' should be used.
- *
- * The 'legacy_enabled' and 'legacy_disabled' should not be used for new applications.
- *
- * @publicApi
- */
- declare type InitialNavigation = true | false | 'enabled' | 'disabled' | 'legacy_enabled' | 'legacy_disabled';
- /**
- *
- * A string of the form `path/to/file#exportName` that acts as a URL for a set of routes to load,
- * or a function that returns such a set.
- *
- * The string form of `LoadChildren` is deprecated (see `DeprecatedLoadChildren`). The function
- * form (`LoadChildrenCallback`) should be used instead.
- *
- * @see `Route#loadChildren`.
- * @publicApi
- */
- export declare type LoadChildren = LoadChildrenCallback | DeprecatedLoadChildren;
- /**
- *
- * A function that is called to resolve a collection of lazy-loaded routes.
- *
- * Often this function will be implemented using an ES dynamic `import()` expression. For example:
- *
- * ```
- * [{
- * path: 'lazy',
- * loadChildren: () => import('./lazy-route/lazy.module').then(mod => mod.LazyModule),
- * }];
- * ```
- *
- * This function _must_ match the form above: an arrow function of the form
- * `() => import('...').then(mod => mod.MODULE)`.
- *
- * @see `Route#loadChildren`.
- * @publicApi
- */
- export declare type LoadChildrenCallback = () => Type<any> | NgModuleFactory<any> | Observable<Type<any>> | Promise<NgModuleFactory<any> | Type<any> | any>;
- /**
- * @description
- *
- * Information about any given navigation. This information can be gotten from the router at
- * any time using the `router.getCurrentNavigation()` method.
- *
- * @publicApi
- */
- export declare type Navigation = {
- /**
- * The ID of the current navigation.
- */
- id: number;
- /**
- * Target URL passed into the {@link Router#navigateByUrl} call before navigation. This is
- * the value before the router has parsed or applied redirects to it.
- */
- initialUrl: string | UrlTree;
- /**
- * The initial target URL after being parsed with {@link UrlSerializer.extract()}.
- */
- extractedUrl: UrlTree;
- /**
- * Extracted URL after redirects have been applied. This URL may not be available immediately,
- * therefore this property can be `undefined`. It is guaranteed to be set after the
- * {@link RoutesRecognized} event fires.
- */
- finalUrl?: UrlTree;
- /**
- * Identifies the trigger of the navigation.
- *
- * * 'imperative'--triggered by `router.navigateByUrl` or `router.navigate`.
- * * 'popstate'--triggered by a popstate event
- * * 'hashchange'--triggered by a hashchange event
- */
- trigger: 'imperative' | 'popstate' | 'hashchange';
- /**
- * The NavigationExtras used in this navigation. See {@link NavigationExtras} for more info.
- */
- extras: NavigationExtras;
- /**
- * Previously successful Navigation object. Only a single previous Navigation is available,
- * therefore this previous Navigation will always have a `null` value for `previousNavigation`.
- */
- previousNavigation: Navigation | null;
- };
- /**
- * @description
- *
- * Represents an event triggered when a navigation is canceled.
- *
- * @publicApi
- */
- export declare class NavigationCancel extends RouterEvent {
- /** @docsNotRequired */
- reason: string;
- constructor(
- /** @docsNotRequired */
- id: number,
- /** @docsNotRequired */
- url: string,
- /** @docsNotRequired */
- reason: string);
- /** @docsNotRequired */
- toString(): string;
- }
- /**
- * @description
- *
- * Represents an event triggered when a navigation ends successfully.
- *
- * @publicApi
- */
- export declare class NavigationEnd extends RouterEvent {
- /** @docsNotRequired */
- urlAfterRedirects: string;
- constructor(
- /** @docsNotRequired */
- id: number,
- /** @docsNotRequired */
- url: string,
- /** @docsNotRequired */
- urlAfterRedirects: string);
- /** @docsNotRequired */
- toString(): string;
- }
- /**
- * @description
- *
- * Represents an event triggered when a navigation fails due to an unexpected error.
- *
- * @publicApi
- */
- export declare class NavigationError extends RouterEvent {
- /** @docsNotRequired */
- error: any;
- constructor(
- /** @docsNotRequired */
- id: number,
- /** @docsNotRequired */
- url: string,
- /** @docsNotRequired */
- error: any);
- /** @docsNotRequired */
- toString(): string;
- }
- /**
- * @description
- *
- * Options that modify the navigation strategy.
- *
- * @publicApi
- */
- export declare interface NavigationExtras {
- /**
- * Enables relative navigation from the current ActivatedRoute.
- *
- * Configuration:
- *
- * ```
- * [{
- * path: 'parent',
- * component: ParentComponent,
- * children: [{
- * path: 'list',
- * component: ListComponent
- * },{
- * path: 'child',
- * component: ChildComponent
- * }]
- * }]
- * ```
- *
- * Navigate to list route from child route:
- *
- * ```
- * @Component({...})
- * class ChildComponent {
- * constructor(private router: Router, private route: ActivatedRoute) {}
- *
- * go() {
- * this.router.navigate(['../list'], { relativeTo: this.route });
- * }
- * }
- * ```
- */
- relativeTo?: ActivatedRoute | null;
- /**
- * Sets query parameters to the URL.
- *
- * ```
- * // Navigate to /results?page=1
- * this.router.navigate(['/results'], { queryParams: { page: 1 } });
- * ```
- */
- queryParams?: Params | null;
- /**
- * Sets the hash fragment for the URL.
- *
- * ```
- * // Navigate to /results#top
- * this.router.navigate(['/results'], { fragment: 'top' });
- * ```
- */
- fragment?: string;
- /**
- * DEPRECATED: Use `queryParamsHandling` instead to preserve
- * query parameters for the next navigation.
- *
- * ```
- * // Preserve query params from /results?page=1 to /view?page=1
- * this.router.navigate(['/view'], { preserveQueryParams: true });
- * ```
- *
- * @deprecated since v4
- */
- preserveQueryParams?: boolean;
- /**
- * Configuration strategy for how to handle query parameters for the next navigation.
- *
- * ```
- * // from /results?page=1 to /view?page=1&page=2
- * this.router.navigate(['/view'], { queryParams: { page: 2 }, queryParamsHandling: "merge" });
- * ```
- */
- queryParamsHandling?: QueryParamsHandling | null;
- /**
- * Preserves the fragment for the next navigation
- *
- * ```
- * // Preserve fragment from /results#top to /view#top
- * this.router.navigate(['/view'], { preserveFragment: true });
- * ```
- */
- preserveFragment?: boolean;
- /**
- * Navigates without pushing a new state into history.
- *
- * ```
- * // Navigate silently to /view
- * this.router.navigate(['/view'], { skipLocationChange: true });
- * ```
- */
- skipLocationChange?: boolean;
- /**
- * Navigates while replacing the current state in history.
- *
- * ```
- * // Navigate to /view
- * this.router.navigate(['/view'], { replaceUrl: true });
- * ```
- */
- replaceUrl?: boolean;
- /**
- * State passed to any navigation. This value will be accessible through the `extras` object
- * returned from `router.getCurrentNavigation()` while a navigation is executing. Once a
- * navigation completes, this value will be written to `history.state` when the `location.go`
- * or `location.replaceState` method is called before activating of this route. Note that
- * `history.state` will not pass an object equality test because the `navigationId` will be
- * added to the state before being written.
- *
- * While `history.state` can accept any type of value, because the router adds the `navigationId`
- * on each navigation, the `state` must always be an object.
- */
- state?: {
- [k: string]: any;
- };
- }
- /**
- * @description
- *
- * Represents an event triggered when a navigation starts.
- *
- * @publicApi
- */
- export declare class NavigationStart extends RouterEvent {
- /**
- * Identifies the trigger of the navigation.
- *
- * * 'imperative'--triggered by `router.navigateByUrl` or `router.navigate`.
- * * 'popstate'--triggered by a popstate event
- * * 'hashchange'--triggered by a hashchange event
- */
- navigationTrigger?: 'imperative' | 'popstate' | 'hashchange';
- /**
- * This reflects the state object that was previously supplied to the pushState call. This is
- * not null only when the navigation is triggered by a popstate event.
- *
- * The router assigns a navigationId to every router transition/navigation. Even when the user
- * clicks on the back button in the browser, a new navigation id will be created. So from
- * the perspective of the router, the router never "goes back". By using the `restoredState`
- * and its navigationId, you can implement behavior that differentiates between creating new
- * states
- * and popstate events. In the latter case you can restore some remembered state (e.g., scroll
- * position).
- *
- * See {@link NavigationExtras} for more information.
- */
- restoredState?: {
- [k: string]: any;
- navigationId: number;
- } | null;
- constructor(
- /** @docsNotRequired */
- id: number,
- /** @docsNotRequired */
- url: string,
- /** @docsNotRequired */
- navigationTrigger?: 'imperative' | 'popstate' | 'hashchange',
- /** @docsNotRequired */
- restoredState?: {
- [k: string]: any;
- navigationId: number;
- } | null);
- /** @docsNotRequired */
- toString(): string;
- }
- /**
- * @description
- *
- * Provides a preloading strategy that does not preload any modules.
- *
- * This strategy is enabled by default.
- *
- * @publicApi
- */
- export declare class NoPreloading implements PreloadingStrategy {
- preload(route: Route, fn: () => Observable<any>): Observable<any>;
- }
- /**
- * Store contextual information about a `RouterOutlet`
- *
- * @publicApi
- */
- export declare class OutletContext {
- outlet: RouterOutlet | null;
- route: ActivatedRoute | null;
- resolver: ComponentFactoryResolver | null;
- children: ChildrenOutletContexts;
- attachRef: ComponentRef<any> | null;
- }
- /**
- * Matrix and Query parameters.
- *
- * `ParamMap` makes it easier to work with parameters as they could have either a single value or
- * multiple value. Because this should be known by the user, calling `get` or `getAll` returns the
- * correct type (either `string` or `string[]`).
- *
- * The API is inspired by the URLSearchParams interface.
- * see https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams
- *
- * @publicApi
- */
- export declare interface ParamMap {
- has(name: string): boolean;
- /**
- * Return a single value for the given parameter name:
- * - the value when the parameter has a single value,
- * - the first value if the parameter has multiple values,
- * - `null` when there is no such parameter.
- */
- get(name: string): string | null;
- /**
- * Return an array of values for the given parameter name.
- *
- * If there is no such parameter, an empty array is returned.
- */
- getAll(name: string): string[];
- /** Name of the parameters */
- readonly keys: string[];
- }
- /**
- * A collection of parameters.
- *
- * @publicApi
- */
- export declare type Params = {
- [key: string]: any;
- };
- /**
- * @description
- *
- * Provides a preloading strategy that preloads all modules as quickly as possible.
- *
- * ```
- * RouteModule.forRoot(ROUTES, {preloadingStrategy: PreloadAllModules})
- * ```
- *
- * @publicApi
- */
- export declare class PreloadAllModules implements PreloadingStrategy {
- preload(route: Route, fn: () => Observable<any>): Observable<any>;
- }
- /**
- * @description
- *
- * Provides a preloading strategy.
- *
- * @publicApi
- */
- export declare abstract class PreloadingStrategy {
- abstract preload(route: Route, fn: () => Observable<any>): Observable<any>;
- }
- /**
- * @description
- *
- * Name of the primary outlet.
- *
- * @publicApi
- */
- export declare const PRIMARY_OUTLET = "primary";
- /**
- * @description
- *
- * Registers routes.
- *
- * @usageNotes
- * ### Example
- *
- * ```
- * @NgModule({
- * imports: [RouterModule.forChild(ROUTES)],
- * providers: [provideRoutes(EXTRA_ROUTES)]
- * })
- * class MyNgModule {}
- * ```
- *
- * @publicApi
- */
- export declare function provideRoutes(routes: Routes): any;
- /**
- *
- * How to handle query parameters in a router link.
- * One of:
- * - `merge` : Merge new with current parameters.
- * - `preserve` : Preserve current parameters.
- *
- * @see `RouterLink#queryParamsHandling`.
- * @publicApi
- */
- declare type QueryParamsHandling = 'merge' | 'preserve' | '';
- /**
- * @description
- *
- * Interface that classes can implement to be a data provider.
- *
- * ```
- * class Backend {
- * fetchTeam(id: string) {
- * return 'someTeam';
- * }
- * }
- *
- * @Injectable()
- * class TeamResolver implements Resolve<Team> {
- * constructor(private backend: Backend) {}
- *
- * resolve(
- * route: ActivatedRouteSnapshot,
- * state: RouterStateSnapshot
- * ): Observable<any>|Promise<any>|any {
- * return this.backend.fetchTeam(route.params.id);
- * }
- * }
- *
- * @NgModule({
- * imports: [
- * RouterModule.forRoot([
- * {
- * path: 'team/:id',
- * component: TeamComponent,
- * resolve: {
- * team: TeamResolver
- * }
- * }
- * ])
- * ],
- * providers: [TeamResolver]
- * })
- * class AppModule {}
- * ```
- *
- * You can alternatively provide a function with the `resolve` signature:
- *
- * ```
- * @NgModule({
- * imports: [
- * RouterModule.forRoot([
- * {
- * path: 'team/:id',
- * component: TeamComponent,
- * resolve: {
- * team: 'teamResolver'
- * }
- * }
- * ])
- * ],
- * providers: [
- * {
- * provide: 'teamResolver',
- * useValue: (route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => 'team'
- * }
- * ]
- * })
- * class AppModule {}
- * ```
- *
- * @publicApi
- */
- export declare interface Resolve<T> {
- resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<T> | Promise<T> | T;
- }
- /**
- *
- * Represents the resolved data associated with a particular route.
- *
- * @see `Route#resolve`.
- *
- * @publicApi
- */
- export declare type ResolveData = {
- [name: string]: any;
- };
- /**
- * @description
- *
- * Represents the end of the Resolve phase of routing. See note on
- * `ResolveStart` for use of this experimental API.
- *
- * @publicApi
- */
- export declare class ResolveEnd extends RouterEvent {
- /** @docsNotRequired */
- urlAfterRedirects: string;
- /** @docsNotRequired */
- state: RouterStateSnapshot;
- constructor(
- /** @docsNotRequired */
- id: number,
- /** @docsNotRequired */
- url: string,
- /** @docsNotRequired */
- urlAfterRedirects: string,
- /** @docsNotRequired */
- state: RouterStateSnapshot);
- toString(): string;
- }
- /**
- * @description
- *
- * Represents the start of the Resolve phase of routing. The timing of this
- * event may change, thus it's experimental. In the current iteration it will run
- * in the "resolve" phase whether there's things to resolve or not. In the future this
- * behavior may change to only run when there are things to be resolved.
- *
- * @publicApi
- */
- export declare class ResolveStart extends RouterEvent {
- /** @docsNotRequired */
- urlAfterRedirects: string;
- /** @docsNotRequired */
- state: RouterStateSnapshot;
- constructor(
- /** @docsNotRequired */
- id: number,
- /** @docsNotRequired */
- url: string,
- /** @docsNotRequired */
- urlAfterRedirects: string,
- /** @docsNotRequired */
- state: RouterStateSnapshot);
- toString(): string;
- }
- /**
- * A configuration object that defines a single route.
- * A set of routes are collected in a `Routes` array to define a `Router` configuration.
- * The router attempts to match segments of a given URL against each route,
- * using the configuration options defined in this object.
- *
- * Supports static, parameterized, redirect, and wildcard routes, as well as
- * custom route data and resolve methods.
- *
- * For detailed usage information, see the [Routing Guide](guide/router).
- *
- * @usageNotes
- *
- * ### Simple Configuration
- *
- * The following route specifies that when navigating to, for example,
- * `/team/11/user/bob`, the router creates the 'Team' component
- * with the 'User' child component in it.
- *
- * ```
- * [{
- * path: 'team/:id',
- * component: Team,
- * children: [{
- * path: 'user/:name',
- * component: User
- * }]
- * }]
- * ```
- *
- * ### Multiple Outlets
- *
- * The following route creates sibling components with multiple outlets.
- * When navigating to `/team/11(aux:chat/jim)`, the router creates the 'Team' component next to
- * the 'Chat' component. The 'Chat' component is placed into the 'aux' outlet.
- *
- * ```
- * [{
- * path: 'team/:id',
- * component: Team
- * }, {
- * path: 'chat/:user',
- * component: Chat
- * outlet: 'aux'
- * }]
- * ```
- *
- * ### Wild Cards
- *
- * The following route uses wild-card notation to specify a component
- * that is always instantiated regardless of where you navigate to.
- *
- * ```
- * [{
- * path: '**',
- * component: WildcardComponent
- * }]
- * ```
- *
- * ### Redirects
- *
- * The following route uses the `redirectTo` property to ignore a segment of
- * a given URL when looking for a child path.
- *
- * When navigating to '/team/11/legacy/user/jim', the router changes the URL segment
- * '/team/11/legacy/user/jim' to '/team/11/user/jim', and then instantiates
- * the Team component with the User child component in it.
- *
- * ```
- * [{
- * path: 'team/:id',
- * component: Team,
- * children: [{
- * path: 'legacy/user/:name',
- * redirectTo: 'user/:name'
- * }, {
- * path: 'user/:name',
- * component: User
- * }]
- * }]
- * ```
- *
- * The redirect path can be relative, as shown in this example, or absolute.
- * If we change the `redirectTo` value in the example to the absolute URL segment '/user/:name',
- * the result URL is also absolute, '/user/jim'.
- * ### Empty Path
- *
- * Empty-path route configurations can be used to instantiate components that do not 'consume'
- * any URL segments.
- *
- * In the following configuration, when navigating to
- * `/team/11`, the router instantiates the 'AllUsers' component.
- *
- * ```
- * [{
- * path: 'team/:id',
- * component: Team,
- * children: [{
- * path: '',
- * component: AllUsers
- * }, {
- * path: 'user/:name',
- * component: User
- * }]
- * }]
- * ```
- *
- * Empty-path routes can have children. In the following example, when navigating
- * to `/team/11/user/jim`, the router instantiates the wrapper component with
- * the user component in it.
- *
- * Note that an empty path route inherits its parent's parameters and data.
- *
- * ```
- * [{
- * path: 'team/:id',
- * component: Team,
- * children: [{
- * path: '',
- * component: WrapperCmp,
- * children: [{
- * path: 'user/:name',
- * component: User
- * }]
- * }]
- * }]
- * ```
- *
- * ### Matching Strategy
- *
- * The default path-match strategy is 'prefix', which means that the router
- * checks URL elements from the left to see if the URL matches a specified path.
- * For example, '/team/11/user' matches 'team/:id'.
- *
- * ```
- * [{
- * path: '',
- * pathMatch: 'prefix', //default
- * redirectTo: 'main'
- * }, {
- * path: 'main',
- * component: Main
- * }]
- * ```
- *
- * You can specify the path-match strategy 'full' to make sure that the path
- * covers the whole unconsumed URL. It is important to do this when redirecting
- * empty-path routes. Otherwise, because an empty path is a prefix of any URL,
- * the router would apply the redirect even when navigating to the redirect destination,
- * creating an endless loop.
- *
- * In the following example, supplying the 'full' `patchMatch` strategy ensures
- * that the router applies the redirect if and only if navigating to '/'.
- *
- * ```
- * [{
- * path: '',
- * pathMatch: 'full',
- * redirectTo: 'main'
- * }, {
- * path: 'main',
- * component: Main
- * }]
- * ```
- *
- * ### Componentless Routes
- *
- * You can share parameters between sibling components.
- * For example, suppose that two sibling components should go next to each other,
- * and both of them require an ID parameter. You can accomplish this using a route
- * that does not specify a component at the top level.
- *
- * In the following example, 'ChildCmp' and 'AuxCmp' are siblings.
- * When navigating to 'parent/10/(a//aux:b)', the route instantiates
- * the main child and aux child components next to each other.
- * For this to work, the application component must have the primary and aux outlets defined.
- *
- * ```
- * [{
- * path: 'parent/:id',
- * children: [
- * { path: 'a', component: MainChild },
- * { path: 'b', component: AuxChild, outlet: 'aux' }
- * ]
- * }]
- * ```
- *
- * The router merges the parameters, data, and resolve of the componentless
- * parent into the parameters, data, and resolve of the children.
- *
- * This is especially useful when child components are defined
- * with an empty path string, as in the following example.
- * With this configuration, navigating to '/parent/10' creates
- * the main child and aux components.
- *
- * ```
- * [{
- * path: 'parent/:id',
- * children: [
- * { path: '', component: MainChild },
- * { path: '', component: AuxChild, outlet: 'aux' }
- * ]
- * }]
- * ```
- *
- * ### Lazy Loading
- *
- * Lazy loading speeds up application load time by splitting the application
- * into multiple bundles and loading them on demand.
- * To use lazy loading, provide the `loadChildren` property instead of the `children` property.
- *
- * Given the following example route, the router uses the registered
- * `NgModuleFactoryLoader` to fetch an NgModule associated with 'team'.
- * It then extracts the set of routes defined in that NgModule,
- * and transparently adds those routes to the main configuration.
- *
- * ```
- * [{
- * path: 'team/:id',
- * component: Team,
- * loadChildren: 'team'
- * }]
- * ```
- *
- * @publicApi
- */
- export declare interface Route {
- /**
- * The path to match against, a URL string that uses router matching notation.
- * Can be a wild card (`**`) that matches any URL (see Usage Notes below).
- * Default is "/" (the root path).
- */
- path?: string;
- /**
- * The path-matching strategy, one of 'prefix' or 'full'.
- * Default is 'prefix'.
- *
- * By default, the router checks URL elements from the left to see if the URL
- * matches a given path, and stops when there is a match. For example,
- * '/team/11/user' matches 'team/:id'.
- *
- * The path-match strategy 'full' matches against the entire URL.
- * It is important to do this when redirecting empty-path routes.
- * Otherwise, because an empty path is a prefix of any URL,
- * the router would apply the redirect even when navigating
- * to the redirect destination, creating an endless loop.
- *
- */
- pathMatch?: string;
- /**
- * A URL-matching function to use as a custom strategy for path matching.
- * If present, supersedes `path` and `pathMatch`.
- */
- matcher?: UrlMatcher;
- /**
- * The component to instantiate when the path matches.
- * Can be empty if child routes specify components.
- */
- component?: Type<any>;
- /**
- * A URL to which to redirect when a the path matches.
- * Absolute if the URL begins with a slash (/), otherwise relative to the path URL.
- * When not present, router does not redirect.
- */
- redirectTo?: string;
- /**
- * Name of a `RouterOutlet` object where the component can be placed
- * when the path matches.
- */
- outlet?: string;
- /**
- * An array of dependency-injection tokens used to look up `CanActivate()`
- * handlers, in order to determine if the current user is allowed to
- * activate the component. By default, any user can activate.
- */
- canActivate?: any[];
- /**
- * An array of DI tokens used to look up `CanActivateChild()` handlers,
- * in order to determine if the current user is allowed to activate
- * a child of the component. By default, any user can activate a child.
- */
- canActivateChild?: any[];
- /**
- * An array of DI tokens used to look up `CanDeactivate()`
- * handlers, in order to determine if the current user is allowed to
- * deactivate the component. By default, any user can deactivate.
- *
- */
- canDeactivate?: any[];
- /**
- * An array of DI tokens used to look up `CanLoad()`
- * handlers, in order to determine if the current user is allowed to
- * load the component. By default, any user can load.
- */
- canLoad?: any[];
- /**
- * Additional developer-defined data provided to the component via
- * `ActivatedRoute`. By default, no additional data is passed.
- */
- data?: Data;
- /**
- * A map of DI tokens used to look up data resolvers. See `Resolve`.
- */
- resolve?: ResolveData;
- /**
- * An array of child `Route` objects that specifies a nested route
- * configuration.
- */
- children?: Routes;
- /**
- * A `LoadChildren` object specifying lazy-loaded child routes.
- */
- loadChildren?: LoadChildren;
- /**
- * Defines when guards and resolvers will be run. One of
- * - `paramsOrQueryParamsChange` : Run when query parameters change.
- * - `always` : Run on every execution.
- * By default, guards and resolvers run only when the matrix
- * parameters of the route change.
- */
- runGuardsAndResolvers?: RunGuardsAndResolvers;
- }
- /**
- * @description
- *
- * Represents an event triggered when a route has been lazy loaded.
- *
- * @publicApi
- */
- export declare class RouteConfigLoadEnd {
- /** @docsNotRequired */
- route: Route;
- constructor(
- /** @docsNotRequired */
- route: Route);
- toString(): string;
- }
- /**
- * @description
- *
- * Represents an event triggered before lazy loading a route config.
- *
- * @publicApi
- */
- export declare class RouteConfigLoadStart {
- /** @docsNotRequired */
- route: Route;
- constructor(
- /** @docsNotRequired */
- route: Route);
- toString(): string;
- }
- /**
- * @description
- *
- * An NgModule that provides navigation and URL manipulation capabilities.
- *
- * @see `Route`.
- * @see [Routing and Navigation Guide](guide/router).
- *
- * @ngModule RouterModule
- *
- * @publicApi
- */
- export declare class Router {
- private rootComponentType;
- private urlSerializer;
- private rootContexts;
- private location;
- config: Routes;
- private currentUrlTree;
- private rawUrlTree;
- private browserUrlTree;
- private readonly transitions;
- private navigations;
- private lastSuccessfulNavigation;
- private currentNavigation;
- private locationSubscription;
- private navigationId;
- private configLoader;
- private ngModule;
- private console;
- private isNgZoneEnabled;
- /**
- * An event stream for routing events in this NgModule.
- */
- readonly events: Observable<Event>;
- /**
- * The current state of routing in this NgModule.
- */
- readonly routerState: RouterState;
- /**
- * A handler for navigation errors in this NgModule.
- */
- errorHandler: ErrorHandler;
- /**
- * Malformed uri error handler is invoked when `Router.parseUrl(url)` throws an
- * error due to containing an invalid character. The most common case would be a `%` sign
- * that's not encoded and is not part of a percent encoded sequence.
- */
- malformedUriErrorHandler: (error: URIError, urlSerializer: UrlSerializer, url: string) => UrlTree;
- /**
- * True if at least one navigation event has occurred,
- * false otherwise.
- */
- navigated: boolean;
- private lastSuccessfulId;
- /**
- * Extracts and merges URLs. Used for AngularJS to Angular migrations.
- */
- urlHandlingStrategy: UrlHandlingStrategy;
- /**
- * The strategy for re-using routes.
- */
- routeReuseStrategy: RouteReuseStrategy;
- /**
- * How to handle a navigation request to the current URL. One of:
- * - `'ignore'` : The router ignores the request.
- * - `'reload'` : The router reloads the URL. Use to implement a "refresh" feature.
- */
- onSameUrlNavigation: 'reload' | 'ignore';
- /**
- * How to merge parameters, data, and resolved data from parent to child
- * routes. One of:
- *
- * - `'emptyOnly'` : Inherit parent parameters, data, and resolved data
- * for path-less or component-less routes.
- * - `'always'` : Inherit parent parameters, data, and resolved data
- * for all child routes.
- */
- paramsInheritanceStrategy: 'emptyOnly' | 'always';
- /**
- * Defines when the router updates the browser URL. The default behavior is to update after
- * successful navigation. However, some applications may prefer a mode where the URL gets
- * updated at the beginning of navigation. The most common use case would be updating the
- * URL early so if navigation fails, you can show an error message with the URL that failed.
- * Available options are:
- *
- * - `'deferred'`, the default, updates the browser URL after navigation has finished.
- * - `'eager'`, updates browser URL at the beginning of navigation.
- */
- urlUpdateStrategy: 'deferred' | 'eager';
- /**
- * See {@link RouterModule} for more information.
- */
- relativeLinkResolution: 'legacy' | 'corrected';
- /**
- * Creates the router service.
- */
- constructor(rootComponentType: Type<any> | null, urlSerializer: UrlSerializer, rootContexts: ChildrenOutletContexts, location: Location, injector: Injector, loader: NgModuleFactoryLoader, compiler: Compiler, config: Routes);
- private setupNavigations;
- private getTransition;
- private setTransition;
- /**
- * Sets up the location change listener and performs the initial navigation.
- */
- initialNavigation(): void;
- /**
- * Sets up the location change listener.
- */
- setUpLocationChangeListener(): void;
- /** The current URL. */
- readonly url: string;
- /** The current Navigation object if one exists */
- getCurrentNavigation(): Navigation | null;
- /**
- * Resets the configuration used for navigation and generating links.
- *
- * @param config The route array for the new configuration.
- *
- * @usageNotes
- *
- * ```
- * router.resetConfig([
- * { path: 'team/:id', component: TeamCmp, children: [
- * { path: 'simple', component: SimpleCmp },
- * { path: 'user/:name', component: UserCmp }
- * ]}
- * ]);
- * ```
- */
- resetConfig(config: Routes): void;
- /** @docsNotRequired */
- ngOnDestroy(): void;
- /** Disposes of the router. */
- dispose(): void;
- /**
- * Applies an array of commands to the current URL tree and creates a new URL tree.
- *
- * When given an activate route, applies the given commands starting from the route.
- * When not given a route, applies the given command starting from the root.
- *
- * @param commands An array of commands to apply.
- * @param navigationExtras
- * @returns The new URL tree.
- *
- * @usageNotes
- *
- * ```
- * // create /team/33/user/11
- * router.createUrlTree(['/team', 33, 'user', 11]);
- *
- * // create /team/33;expand=true/user/11
- * router.createUrlTree(['/team', 33, {expand: true}, 'user', 11]);
- *
- * // you can collapse static segments like this (this works only with the first passed-in value):
- * router.createUrlTree(['/team/33/user', userId]);
- *
- * // If the first segment can contain slashes, and you do not want the router to split it, you
- * // can do the following:
- *
- * router.createUrlTree([{segmentPath: '/one/two'}]);
- *
- * // create /team/33/(user/11//right:chat)
- * router.createUrlTree(['/team', 33, {outlets: {primary: 'user/11', right: 'chat'}}]);
- *
- * // remove the right secondary node
- * router.createUrlTree(['/team', 33, {outlets: {primary: 'user/11', right: null}}]);
- *
- * // assuming the current url is `/team/33/user/11` and the route points to `user/11`
- *
- * // navigate to /team/33/user/11/details
- * router.createUrlTree(['details'], {relativeTo: route});
- *
- * // navigate to /team/33/user/22
- * router.createUrlTree(['../22'], {relativeTo: route});
- *
- * // navigate to /team/44/user/22
- * router.createUrlTree(['../../team/44/user/22'], {relativeTo: route});
- * ```
- */
- createUrlTree(commands: any[], navigationExtras?: NavigationExtras): UrlTree;
- /**
- * Navigate based on the provided URL, which must be absolute.
- *
- * @param url An absolute URL. The function does not apply any delta to the current URL.
- * @param extras An object containing properties that modify the navigation strategy.
- * The function ignores any properties in the `NavigationExtras` that would change the
- * provided URL.
- *
- * @returns A Promise that resolves to 'true' when navigation succeeds,
- * to 'false' when navigation fails, or is rejected on error.
- *
- * @usageNotes
- *
- * ### Example
- *
- * ```
- * router.navigateByUrl("/team/33/user/11");
- *
- * // Navigate without updating the URL
- * router.navigateByUrl("/team/33/user/11", { skipLocationChange: true });
- * ```
- *
- */
- navigateByUrl(url: string | UrlTree, extras?: NavigationExtras): Promise<boolean>;
- /**
- * Navigate based on the provided array of commands and a starting point.
- * If no starting route is provided, the navigation is absolute.
- *
- * Returns a promise that:
- * - resolves to 'true' when navigation succeeds,
- * - resolves to 'false' when navigation fails,
- * - is rejected when an error happens.
- *
- * @usageNotes
- *
- * ### Example
- *
- * ```
- * router.navigate(['team', 33, 'user', 11], {relativeTo: route});
- *
- * // Navigate without updating the URL
- * router.navigate(['team', 33, 'user', 11], {relativeTo: route, skipLocationChange: true});
- * ```
- *
- * The first parameter of `navigate()` is a delta to be applied to the current URL
- * or the one provided in the `relativeTo` property of the second parameter (the
- * `NavigationExtras`).
- *
- * In order to affect this browser's `history.state` entry, the `state`
- * parameter can be passed. This must be an object because the router
- * will add the `navigationId` property to this object before creating
- * the new history item.
- */
- navigate(commands: any[], extras?: NavigationExtras): Promise<boolean>;
- /** Serializes a `UrlTree` into a string */
- serializeUrl(url: UrlTree): string;
- /** Parses a string into a `UrlTree` */
- parseUrl(url: string): UrlTree;
- /** Returns whether the url is activated */
- isActive(url: string | UrlTree, exact: boolean): boolean;
- private removeEmptyProps;
- private processNavigations;
- private scheduleNavigation;
- private setBrowserUrl;
- private resetStateAndUrl;
- private resetUrlToCurrentUrlTree;
- }
- /**
- * @description
- *
- * Is used in DI to configure the router.
- *
- * @publicApi
- */
- export declare const ROUTER_CONFIGURATION: InjectionToken<ExtraOptions>;
- /**
- * A token for the router initializer that will be called after the app is bootstrapped.
- *
- * @publicApi
- */
- export declare const ROUTER_INITIALIZER: InjectionToken<(compRef: ComponentRef<any>) => void>;
- /**
- * @description
- *
- * Provides a way to customize when activated routes get reused.
- *
- * @publicApi
- */
- export declare abstract class RouteReuseStrategy {
- /** Determines if this route (and its subtree) should be detached to be reused later */
- abstract shouldDetach(route: ActivatedRouteSnapshot): boolean;
- /**
- * Stores the detached route.
- *
- * Storing a `null` value should erase the previously stored value.
- */
- abstract store(route: ActivatedRouteSnapshot, handle: DetachedRouteHandle | null): void;
- /** Determines if this route (and its subtree) should be reattached */
- abstract shouldAttach(route: ActivatedRouteSnapshot): boolean;
- /** Retrieves the previously stored route */
- abstract retrieve(route: ActivatedRouteSnapshot): DetachedRouteHandle | null;
- /** Determines if a route should be reused */
- abstract shouldReuseRoute(future: ActivatedRouteSnapshot, curr: ActivatedRouteSnapshot): boolean;
- }
- /**
- * @description
- *
- * Base for events the Router goes through, as opposed to events tied to a specific
- * Route. `RouterEvent`s will only be fired one time for any given navigation.
- *
- * Example:
- *
- * ```
- * class MyService {
- * constructor(public router: Router, logger: Logger) {
- * router.events.pipe(
- * filter(e => e instanceof RouterEvent)
- * ).subscribe(e => {
- * logger.log(e.id, e.url);
- * });
- * }
- * }
- * ```
- *
- * @publicApi
- */
- export declare class RouterEvent {
- /** @docsNotRequired */
- id: number;
- /** @docsNotRequired */
- url: string;
- constructor(
- /** @docsNotRequired */
- id: number,
- /** @docsNotRequired */
- url: string);
- }
- /**
- * @description
- *
- * Lets you link to specific routes in your app.
- *
- * Consider the following route configuration:
- * `[{ path: 'user/:name', component: UserCmp }]`.
- * When linking to this `user/:name` route, you use the `RouterLink` directive.
- *
- * If the link is static, you can use the directive as follows:
- * `<a routerLink="/user/bob">link to user component</a>`
- *
- * If you use dynamic values to generate the link, you can pass an array of path
- * segments, followed by the params for each segment.
- *
- * For instance `['/team', teamId, 'user', userName, {details: true}]`
- * means that we want to generate a link to `/team/11/user/bob;details=true`.
- *
- * Multiple static segments can be merged into one
- * (e.g., `['/team/11/user', userName, {details: true}]`).
- *
- * The first segment name can be prepended with `/`, `./`, or `../`:
- * * If the first segment begins with `/`, the router will look up the route from the root of the
- * app.
- * * If the first segment begins with `./`, or doesn't begin with a slash, the router will
- * instead look in the children of the current activated route.
- * * And if the first segment begins with `../`, the router will go up one level.
- *
- * You can set query params and fragment as follows:
- *
- * ```
- * <a [routerLink]="['/user/bob']" [queryParams]="{debug: true}" fragment="education">
- * link to user component
- * </a>
- * ```
- * RouterLink will use these to generate this link: `/user/bob#education?debug=true`.
- *
- * (Deprecated in v4.0.0 use `queryParamsHandling` instead) You can also tell the
- * directive to preserve the current query params and fragment:
- *
- * ```
- * <a [routerLink]="['/user/bob']" preserveQueryParams preserveFragment>
- * link to user component
- * </a>
- * ```
- *
- * You can tell the directive how to handle queryParams. Available options are:
- * - `'merge'`: merge the queryParams into the current queryParams
- * - `'preserve'`: preserve the current queryParams
- * - default/`''`: use the queryParams only
- *
- * Same options for {@link NavigationExtras#queryParamsHandling
- * NavigationExtras#queryParamsHandling}.
- *
- * ```
- * <a [routerLink]="['/user/bob']" [queryParams]="{debug: true}" queryParamsHandling="merge">
- * link to user component
- * </a>
- * ```
- *
- * You can provide a `state` value to be persisted to the browser's History.state
- * property (See https://developer.mozilla.org/en-US/docs/Web/API/History#Properties). It's
- * used as follows:
- *
- * ```
- * <a [routerLink]="['/user/bob']" [state]="{tracingId: 123}">
- * link to user component
- * </a>
- * ```
- *
- * And later the value can be read from the router through `router.getCurrentNavigation`.
- * For example, to capture the `tracingId` above during the `NavigationStart` event:
- *
- * ```
- * // Get NavigationStart events
- * router.events.pipe(filter(e => e instanceof NavigationStart)).subscribe(e => {
- * const navigation = router.getCurrentNavigation();
- * tracingService.trace({id: navigation.extras.state.tracingId});
- * });
- * ```
- *
- * The router link directive always treats the provided input as a delta to the current url.
- *
- * For instance, if the current url is `/user/(box//aux:team)`.
- *
- * Then the following link `<a [routerLink]="['/user/jim']">Jim</a>` will generate the link
- * `/user/(jim//aux:team)`.
- *
- * See {@link Router#createUrlTree createUrlTree} for more information.
- *
- * @ngModule RouterModule
- *
- * @publicApi
- */
- export declare class RouterLink {
- private router;
- private route;
- queryParams: {
- [k: string]: any;
- };
- fragment: string;
- queryParamsHandling: QueryParamsHandling;
- preserveFragment: boolean;
- skipLocationChange: boolean;
- replaceUrl: boolean;
- state?: {
- [k: string]: any;
- };
- private commands;
- private preserve;
- constructor(router: Router, route: ActivatedRoute, tabIndex: string, renderer: Renderer2, el: ElementRef);
- routerLink: any[] | string;
- /**
- * @deprecated 4.0.0 use `queryParamsHandling` instead.
- */
- preserveQueryParams: boolean;
- onClick(): boolean;
- readonly urlTree: UrlTree;
- }
- /**
- *
- * @description
- *
- * Lets you add a CSS class to an element when the link's route becomes active.
- *
- * This directive lets you add a CSS class to an element when the link's route
- * becomes active.
- *
- * Consider the following example:
- *
- * ```
- * <a routerLink="/user/bob" routerLinkActive="active-link">Bob</a>
- * ```
- *
- * When the url is either '/user' or '/user/bob', the active-link class will
- * be added to the `a` tag. If the url changes, the class will be removed.
- *
- * You can set more than one class, as follows:
- *
- * ```
- * <a routerLink="/user/bob" routerLinkActive="class1 class2">Bob</a>
- * <a routerLink="/user/bob" [routerLinkActive]="['class1', 'class2']">Bob</a>
- * ```
- *
- * You can configure RouterLinkActive by passing `exact: true`. This will add the classes
- * only when the url matches the link exactly.
- *
- * ```
- * <a routerLink="/user/bob" routerLinkActive="active-link" [routerLinkActiveOptions]="{exact:
- * true}">Bob</a>
- * ```
- *
- * You can assign the RouterLinkActive instance to a template variable and directly check
- * the `isActive` status.
- * ```
- * <a routerLink="/user/bob" routerLinkActive #rla="routerLinkActive">
- * Bob {{ rla.isActive ? '(already open)' : ''}}
- * </a>
- * ```
- *
- * Finally, you can apply the RouterLinkActive directive to an ancestor of a RouterLink.
- *
- * ```
- * <div routerLinkActive="active-link" [routerLinkActiveOptions]="{exact: true}">
- * <a routerLink="/user/jim">Jim</a>
- * <a routerLink="/user/bob">Bob</a>
- * </div>
- * ```
- *
- * This will set the active-link class on the div tag if the url is either '/user/jim' or
- * '/user/bob'.
- *
- * @ngModule RouterModule
- *
- * @publicApi
- */
- export declare class RouterLinkActive implements OnChanges, OnDestroy, AfterContentInit {
- private router;
- private element;
- private renderer;
- private link?;
- private linkWithHref?;
- links: QueryList<RouterLink>;
- linksWithHrefs: QueryList<RouterLinkWithHref>;
- private classes;
- private subscription;
- readonly isActive: boolean;
- routerLinkActiveOptions: {
- exact: boolean;
- };
- constructor(router: Router, element: ElementRef, renderer: Renderer2, link?: RouterLink | undefined, linkWithHref?: RouterLinkWithHref | undefined);
- ngAfterContentInit(): void;
- routerLinkActive: string[] | string;
- ngOnChanges(changes: SimpleChanges): void;
- ngOnDestroy(): void;
- private update;
- private isLinkActive;
- private hasActiveLinks;
- }
- /**
- * @description
- *
- * Lets you link to specific routes in your app.
- *
- * See `RouterLink` for more information.
- *
- * @ngModule RouterModule
- *
- * @publicApi
- */
- export declare class RouterLinkWithHref implements OnChanges, OnDestroy {
- private router;
- private route;
- private locationStrategy;
- target: string;
- queryParams: {
- [k: string]: any;
- };
- fragment: string;
- queryParamsHandling: QueryParamsHandling;
- preserveFragment: boolean;
- skipLocationChange: boolean;
- replaceUrl: boolean;
- state?: {
- [k: string]: any;
- };
- private commands;
- private subscription;
- private preserve;
- href: string;
- constructor(router: Router, route: ActivatedRoute, locationStrategy: LocationStrategy);
- routerLink: any[] | string;
- preserveQueryParams: boolean;
- ngOnChanges(changes: {}): any;
- ngOnDestroy(): any;
- onClick(button: number, ctrlKey: boolean, metaKey: boolean, shiftKey: boolean): boolean;
- private updateTargetUrlAndHref;
- readonly urlTree: UrlTree;
- }
- /**
- * @usageNotes
- *
- * RouterModule can be imported multiple times: once per lazily-loaded bundle.
- * Since the router deals with a global shared resource--location, we cannot have
- * more than one router service active.
- *
- * That is why there are two ways to create the module: `RouterModule.forRoot` and
- * `RouterModule.forChild`.
- *
- * * `forRoot` creates a module that contains all the directives, the given routes, and the router
- * service itself.
- * * `forChild` creates a module that contains all the directives and the given routes, but does not
- * include the router service.
- *
- * When registered at the root, the module should be used as follows
- *
- * ```
- * @NgModule({
- * imports: [RouterModule.forRoot(ROUTES)]
- * })
- * class MyNgModule {}
- * ```
- *
- * For submodules and lazy loaded submodules the module should be used as follows:
- *
- * ```
- * @NgModule({
- * imports: [RouterModule.forChild(ROUTES)]
- * })
- * class MyNgModule {}
- * ```
- *
- * @description
- *
- * Adds router directives and providers.
- *
- * Managing state transitions is one of the hardest parts of building applications. This is
- * especially true on the web, where you also need to ensure that the state is reflected in the URL.
- * In addition, we often want to split applications into multiple bundles and load them on demand.
- * Doing this transparently is not trivial.
- *
- * The Angular router solves these problems. Using the router, you can declaratively specify
- * application states, manage state transitions while taking care of the URL, and load bundles on
- * demand.
- *
- * [Read this developer guide](https://angular.io/docs/ts/latest/guide/router.html) to get an
- * overview of how the router should be used.
- *
- * @publicApi
- */
- export declare class RouterModule {
- constructor(guard: any, router: Router);
- /**
- * Creates a module with all the router providers and directives. It also optionally sets up an
- * application listener to perform an initial navigation.
- *
- * Configuration Options:
- *
- * * `enableTracing` Toggles whether the router should log all navigation events to the console.
- * * `useHash` Enables the location strategy that uses the URL fragment instead of the history
- * API.
- * * `initialNavigation` Disables the initial navigation.
- * * `errorHandler` Defines a custom error handler for failed navigations.
- * * `preloadingStrategy` Configures a preloading strategy. See `PreloadAllModules`.
- * * `onSameUrlNavigation` Define what the router should do if it receives a navigation request to
- * the current URL.
- * * `scrollPositionRestoration` Configures if the scroll position needs to be restored when
- * navigating back.
- * * `anchorScrolling` Configures if the router should scroll to the element when the url has a
- * fragment.
- * * `scrollOffset` Configures the scroll offset the router will use when scrolling to an element.
- * * `paramsInheritanceStrategy` Defines how the router merges params, data and resolved data from
- * parent to child routes.
- * * `malformedUriErrorHandler` Defines a custom malformed uri error handler function. This
- * handler is invoked when encodedURI contains invalid character sequences.
- * * `urlUpdateStrategy` Defines when the router updates the browser URL. The default behavior is
- * to update after successful navigation.
- * * `relativeLinkResolution` Enables the correct relative link resolution in components with
- * empty paths.
- *
- * See `ExtraOptions` for more details about the above options.
- */
- static forRoot(routes: Routes, config?: ExtraOptions): ModuleWithProviders<RouterModule>;
- /**
- * Creates a module with all the router directives and a provider registering routes.
- */
- static forChild(routes: Routes): ModuleWithProviders<RouterModule>;
- }
- /**
- * @description
- *
- * Acts as a placeholder that Angular dynamically fills based on the current router state.
- *
- * ```
- * <router-outlet></router-outlet>
- * <router-outlet name='left'></router-outlet>
- * <router-outlet name='right'></router-outlet>
- * ```
- *
- * A router outlet will emit an activate event any time a new component is being instantiated,
- * and a deactivate event when it is being destroyed.
- *
- * ```
- * <router-outlet
- * (activate)='onActivate($event)'
- * (deactivate)='onDeactivate($event)'></router-outlet>
- * ```
- * @ngModule RouterModule
- *
- * @publicApi
- */
- export declare class RouterOutlet implements OnDestroy, OnInit {
- private parentContexts;
- private location;
- private resolver;
- private changeDetector;
- private activated;
- private _activatedRoute;
- private name;
- activateEvents: EventEmitter<any>;
- deactivateEvents: EventEmitter<any>;
- constructor(parentContexts: ChildrenOutletContexts, location: ViewContainerRef, resolver: ComponentFactoryResolver, name: string, changeDetector: ChangeDetectorRef);
- ngOnDestroy(): void;
- ngOnInit(): void;
- readonly isActivated: boolean;
- readonly component: Object;
- readonly activatedRoute: ActivatedRoute;
- readonly activatedRouteData: Data;
- /**
- * Called when the `RouteReuseStrategy` instructs to detach the subtree
- */
- detach(): ComponentRef<any>;
- /**
- * Called when the `RouteReuseStrategy` instructs to re-attach a previously detached subtree
- */
- attach(ref: ComponentRef<any>, activatedRoute: ActivatedRoute): void;
- deactivate(): void;
- activateWith(activatedRoute: ActivatedRoute, resolver: ComponentFactoryResolver | null): void;
- }
- /**
- * The preloader optimistically loads all router configurations to
- * make navigations into lazily-loaded sections of the application faster.
- *
- * The preloader runs in the background. When the router bootstraps, the preloader
- * starts listening to all navigation events. After every such event, the preloader
- * will check if any configurations can be loaded lazily.
- *
- * If a route is protected by `canLoad` guards, the preloaded will not load it.
- *
- * @publicApi
- */
- export declare class RouterPreloader implements OnDestroy {
- private router;
- private injector;
- private preloadingStrategy;
- private loader;
- private subscription;
- constructor(router: Router, moduleLoader: NgModuleFactoryLoader, compiler: Compiler, injector: Injector, preloadingStrategy: PreloadingStrategy);
- setUpPreloading(): void;
- preload(): Observable<any>;
- ngOnDestroy(): void;
- private processRoutes;
- private preloadConfig;
- }
- /**
- * @description
- *
- * Represents the state of the router.
- *
- * RouterState is a tree of activated routes. Every node in this tree knows about the "consumed" URL
- * segments, the extracted parameters, and the resolved data.
- *
- * @usageNotes
- * ### Example
- *
- * ```
- * @Component({templateUrl:'template.html'})
- * class MyComponent {
- * constructor(router: Router) {
- * const state: RouterState = router.routerState;
- * const root: ActivatedRoute = state.root;
- * const child = root.firstChild;
- * const id: Observable<string> = child.params.map(p => p.id);
- * //...
- * }
- * }
- * ```
- *
- * See `ActivatedRoute` for more information.
- *
- * @publicApi
- */
- export declare class RouterState extends ɵangular_packages_router_router_m<ActivatedRoute> {
- /** The current snapshot of the router state */
- snapshot: RouterStateSnapshot;
- toString(): string;
- }
- /**
- * @description
- *
- * Represents the state of the router at a moment in time.
- *
- * This is a tree of activated route snapshots. Every node in this tree knows about
- * the "consumed" URL segments, the extracted parameters, and the resolved data.
- *
- * @usageNotes
- * ### Example
- *
- * ```
- * @Component({templateUrl:'template.html'})
- * class MyComponent {
- * constructor(router: Router) {
- * const state: RouterState = router.routerState;
- * const snapshot: RouterStateSnapshot = state.snapshot;
- * const root: ActivatedRouteSnapshot = snapshot.root;
- * const child = root.firstChild;
- * const id: Observable<string> = child.params.map(p => p.id);
- * //...
- * }
- * }
- * ```
- *
- * @publicApi
- */
- export declare class RouterStateSnapshot extends ɵangular_packages_router_router_m<ActivatedRouteSnapshot> {
- /** The url from which this snapshot was created */
- url: string;
- toString(): string;
- }
- /**
- * @docsNotRequired
- * @publicApi
- */
- export declare const ROUTES: InjectionToken<Route[][]>;
- /**
- * Represents a route configuration for the Router service.
- * An array of `Route` objects, used in `Router.config` and for nested route configurations
- * in `Route.children`.
- *
- * @see `Route`
- * @see `Router`
- * @publicApi
- */
- export declare type Routes = Route[];
- /**
- * @description
- *
- * Represents an event triggered when routes are recognized.
- *
- * @publicApi
- */
- export declare class RoutesRecognized extends RouterEvent {
- /** @docsNotRequired */
- urlAfterRedirects: string;
- /** @docsNotRequired */
- state: RouterStateSnapshot;
- constructor(
- /** @docsNotRequired */
- id: number,
- /** @docsNotRequired */
- url: string,
- /** @docsNotRequired */
- urlAfterRedirects: string,
- /** @docsNotRequired */
- state: RouterStateSnapshot);
- /** @docsNotRequired */
- toString(): string;
- }
- /**
- *
- * A policy for when to run guards and resolvers on a route.
- *
- * @see `Route#runGuardsAndResolvers`
- * @publicApi
- */
- export declare type RunGuardsAndResolvers = 'pathParamsChange' | 'pathParamsOrQueryParamsChange' | 'paramsChange' | 'paramsOrQueryParamsChange' | 'always' | ((from: ActivatedRouteSnapshot, to: ActivatedRouteSnapshot) => boolean);
- /**
- * @description
- *
- * Represents a scrolling event.
- *
- * @publicApi
- */
- export declare class Scroll {
- /** @docsNotRequired */
- readonly routerEvent: NavigationEnd;
- /** @docsNotRequired */
- readonly position: [number, number] | null;
- /** @docsNotRequired */
- readonly anchor: string | null;
- constructor(
- /** @docsNotRequired */
- routerEvent: NavigationEnd,
- /** @docsNotRequired */
- position: [number, number] | null,
- /** @docsNotRequired */
- anchor: string | null);
- toString(): string;
- }
- /**
- * @description
- *
- * Provides a way to migrate AngularJS applications to Angular.
- *
- * @publicApi
- */
- export declare abstract class UrlHandlingStrategy {
- /**
- * Tells the router if this URL should be processed.
- *
- * When it returns true, the router will execute the regular navigation.
- * When it returns false, the router will set the router state to an empty state.
- * As a result, all the active components will be destroyed.
- *
- */
- abstract shouldProcessUrl(url: UrlTree): boolean;
- /**
- * Extracts the part of the URL that should be handled by the router.
- * The rest of the URL will remain untouched.
- */
- abstract extract(url: UrlTree): UrlTree;
- /**
- * Merges the URL fragment with the rest of the URL.
- */
- abstract merge(newUrlPart: UrlTree, rawUrl: UrlTree): UrlTree;
- }
- /**
- * A function for matching a route against URLs. Implement a custom URL matcher
- * for `Route.matcher` when a combination of `path` and `pathMatch`
- * is not expressive enough.
- *
- * @param segments An array of URL segments.
- * @param group A segment group.
- * @param route The route to match against.
- * @returns The match-result,
- *
- * @usageNotes
- *
- * The following matcher matches HTML files.
- *
- * ```
- * export function htmlFiles(url: UrlSegment[]) {
- * return url.length === 1 && url[0].path.endsWith('.html') ? ({consumed: url}) : null;
- * }
- *
- * export const routes = [{ matcher: htmlFiles, component: AnyComponent }];
- * ```
- *
- * @publicApi
- */
- export declare type UrlMatcher = (segments: UrlSegment[], group: UrlSegmentGroup, route: Route) => UrlMatchResult;
- /**
- * Represents the result of matching URLs with a custom matching function.
- *
- * * `consumed` is an array of the consumed URL segments.
- * * `posParams` is a map of positional parameters.
- *
- * @see `UrlMatcher()`
- * @publicApi
- */
- export declare type UrlMatchResult = {
- consumed: UrlSegment[];
- posParams?: {
- [name: string]: UrlSegment;
- };
- };
- /**
- * @description
- *
- * Represents a single URL segment.
- *
- * A UrlSegment is a part of a URL between the two slashes. It contains a path and the matrix
- * parameters associated with the segment.
- *
- * @usageNotes
- * ### Example
- *
- * ```
- * @Component({templateUrl:'template.html'})
- * class MyComponent {
- * constructor(router: Router) {
- * const tree: UrlTree = router.parseUrl('/team;id=33');
- * const g: UrlSegmentGroup = tree.root.children[PRIMARY_OUTLET];
- * const s: UrlSegment[] = g.segments;
- * s[0].path; // returns 'team'
- * s[0].parameters; // returns {id: 33}
- * }
- * }
- * ```
- *
- * @publicApi
- */
- export declare class UrlSegment {
- /** The path part of a URL segment */
- path: string;
- /** The matrix parameters associated with a segment */
- parameters: {
- [name: string]: string;
- };
- constructor(
- /** The path part of a URL segment */
- path: string,
- /** The matrix parameters associated with a segment */
- parameters: {
- [name: string]: string;
- });
- readonly parameterMap: ParamMap;
- /** @docsNotRequired */
- toString(): string;
- }
- /**
- * @description
- *
- * Represents the parsed URL segment group.
- *
- * See `UrlTree` for more information.
- *
- * @publicApi
- */
- export declare class UrlSegmentGroup {
- /** The URL segments of this group. See `UrlSegment` for more information */
- segments: UrlSegment[];
- /** The list of children of this group */
- children: {
- [key: string]: UrlSegmentGroup;
- };
- /** The parent node in the url tree */
- parent: UrlSegmentGroup | null;
- constructor(
- /** The URL segments of this group. See `UrlSegment` for more information */
- segments: UrlSegment[],
- /** The list of children of this group */
- children: {
- [key: string]: UrlSegmentGroup;
- });
- /** Whether the segment has child segments */
- hasChildren(): boolean;
- /** Number of child segments */
- readonly numberOfChildren: number;
- /** @docsNotRequired */
- toString(): string;
- }
- /**
- * @description
- *
- * Serializes and deserializes a URL string into a URL tree.
- *
- * The url serialization strategy is customizable. You can
- * make all URLs case insensitive by providing a custom UrlSerializer.
- *
- * See `DefaultUrlSerializer` for an example of a URL serializer.
- *
- * @publicApi
- */
- export declare abstract class UrlSerializer {
- /** Parse a url into a `UrlTree` */
- abstract parse(url: string): UrlTree;
- /** Converts a `UrlTree` into a url */
- abstract serialize(tree: UrlTree): string;
- }
- /**
- * @description
- *
- * Represents the parsed URL.
- *
- * Since a router state is a tree, and the URL is nothing but a serialized state, the URL is a
- * serialized tree.
- * UrlTree is a data structure that provides a lot of affordances in dealing with URLs
- *
- * @usageNotes
- * ### Example
- *
- * ```
- * @Component({templateUrl:'template.html'})
- * class MyComponent {
- * constructor(router: Router) {
- * const tree: UrlTree =
- * router.parseUrl('/team/33/(user/victor//support:help)?debug=true#fragment');
- * const f = tree.fragment; // return 'fragment'
- * const q = tree.queryParams; // returns {debug: 'true'}
- * const g: UrlSegmentGroup = tree.root.children[PRIMARY_OUTLET];
- * const s: UrlSegment[] = g.segments; // returns 2 segments 'team' and '33'
- * g.children[PRIMARY_OUTLET].segments; // returns 2 segments 'user' and 'victor'
- * g.children['support'].segments; // return 1 segment 'help'
- * }
- * }
- * ```
- *
- * @publicApi
- */
- export declare class UrlTree {
- /** The root segment group of the URL tree */
- root: UrlSegmentGroup;
- /** The query params of the URL */
- queryParams: Params;
- /** The fragment of the URL */
- fragment: string | null;
- readonly queryParamMap: ParamMap;
- /** @docsNotRequired */
- toString(): string;
- }
- /**
- * @publicApi
- */
- export declare const VERSION: Version;
- /**
- * @docsNotRequired
- */
- export declare const ɵangular_packages_router_router_a: InjectionToken<void>;
- export declare function ɵangular_packages_router_router_b(): NgProbeToken;
- export declare function ɵangular_packages_router_router_c(router: Router, viewportScroller: ViewportScroller, config: ExtraOptions): ɵangular_packages_router_router_o;
- export declare function ɵangular_packages_router_router_d(platformLocationStrategy: PlatformLocation, baseHref: string, options?: ExtraOptions): HashLocationStrategy | PathLocationStrategy;
- export declare function ɵangular_packages_router_router_e(router: Router): any;
- export declare function ɵangular_packages_router_router_f(ref: ApplicationRef, urlSerializer: UrlSerializer, contexts: ChildrenOutletContexts, location: Location, injector: Injector, loader: NgModuleFactoryLoader, compiler: Compiler, config: Route[][], opts?: ExtraOptions, urlHandlingStrategy?: UrlHandlingStrategy, routeReuseStrategy?: RouteReuseStrategy): Router;
- export declare function ɵangular_packages_router_router_g(router: Router): ActivatedRoute;
- /**
- * To initialize the router properly we need to do in two steps:
- *
- * We need to start the navigation in a APP_INITIALIZER to block the bootstrap if
- * a resolver or a guards executes asynchronously. Second, we need to actually run
- * activation in a BOOTSTRAP_LISTENER. We utilize the afterPreactivation
- * hook provided by the router to do that.
- *
- * The router navigation starts, reaches the point when preactivation is done, and then
- * pauses. It waits for the hook to be resolved. We then resolve it only in a bootstrap listener.
- */
- export declare class ɵangular_packages_router_router_h {
- private injector;
- private initNavigation;
- private resultOfPreactivationDone;
- constructor(injector: Injector);
- appInitializer(): Promise<any>;
- bootstrapListener(bootstrappedComponentRef: ComponentRef<any>): void;
- private isLegacyEnabled;
- private isLegacyDisabled;
- }
- export declare function ɵangular_packages_router_router_i(r: ɵangular_packages_router_router_h): any;
- export declare function ɵangular_packages_router_router_j(r: ɵangular_packages_router_router_h): any;
- export declare function ɵangular_packages_router_router_k(): (typeof ɵangular_packages_router_router_h | {
- provide: InjectionToken<(() => void)[]>;
- multi: boolean;
- useFactory: typeof ɵangular_packages_router_router_i;
- deps: (typeof ɵangular_packages_router_router_h)[];
- useExisting?: undefined;
- } | {
- provide: InjectionToken<(compRef: ComponentRef<any>) => void>;
- useFactory: typeof ɵangular_packages_router_router_j;
- deps: (typeof ɵangular_packages_router_router_h)[];
- multi?: undefined;
- useExisting?: undefined;
- } | {
- provide: InjectionToken<((compRef: ComponentRef<any>) => void)[]>;
- multi: boolean;
- useExisting: InjectionToken<(compRef: ComponentRef<any>) => void>;
- useFactory?: undefined;
- deps?: undefined;
- })[];
- export declare class ɵangular_packages_router_router_m<T> {
- constructor(root: ɵangular_packages_router_router_n<T>);
- readonly root: T;
- }
- export declare class ɵangular_packages_router_router_n<T> {
- value: T;
- children: ɵangular_packages_router_router_n<T>[];
- constructor(value: T, children: ɵangular_packages_router_router_n<T>[]);
- toString(): string;
- }
- export declare class ɵangular_packages_router_router_o implements OnDestroy {
- private router;
- /** @docsNotRequired */ readonly viewportScroller: ViewportScroller;
- private options;
- private routerEventsSubscription;
- private scrollEventsSubscription;
- private lastId;
- private lastSource;
- private restoredId;
- private store;
- constructor(router: Router,
- /** @docsNotRequired */ viewportScroller: ViewportScroller, options?: {
- scrollPositionRestoration?: 'disabled' | 'enabled' | 'top';
- anchorScrolling?: 'disabled' | 'enabled';
- });
- init(): void;
- private createScrollEvents;
- private consumeScrollEvents;
- private scheduleScrollEvent;
- ngOnDestroy(): void;
- }
- /**
- * This component is used internally within the router to be a placeholder when an empty
- * router-outlet is needed. For example, with a config such as:
- *
- * `{path: 'parent', outlet: 'nav', children: [...]}`
- *
- * In order to render, there needs to be a component on this config, which will default
- * to this `EmptyOutletComponent`.
- */
- declare class ɵEmptyOutletComponent {
- }
- export { ɵEmptyOutletComponent }
- export { ɵEmptyOutletComponent as ɵangular_packages_router_router_l }
- /**
- * Flattens single-level nested arrays.
- */
- export declare function ɵflatten<T>(arr: T[][]): T[];
- export declare const ɵROUTER_PROVIDERS: Provider[];
- export { }
|