UNPKG

@blackbaud/skyux-lib-stache

Version:

This library was generated with [Nx](https://nx.dev).

75 lines (74 loc) 2.12 kB
import { OnDestroy } from '@angular/core'; import { Router, Routes } from '@angular/router'; import { StacheNavLink } from '../nav/nav-link'; import { StacheRouteOptions } from './route-options'; import * as i0 from "@angular/core"; /** * The StacheRouteService assumes the consuming application's routes are "flat", without children. * For example: * ``` * const routes: Routes = [ * { * path: '', * component: HomeComponent, * }, * { * path: 'design', * component: DesignPlaygroundComponent, * data: { * stache: { * name: 'Design', * }, * }, * }, * { * path: 'design/styles', * component: StylesPlaygroundComponent, * data: { * stache: { * name: 'Styles', * }, * }, * }, * ]; * ``` * Import the StacheRouterModule into lazy-loaded modules to give the Stache route service the desired route config. * For example: * ``` * @NgModule({ * import: [ * RouterModule.forChild({...}), * StacheRouterModule.forChild('my-top-level-route') * ] * }) * export class MyLazyLoadedModule {} * ``` * Lazy loaded components will lose the context provided by StacheRouterModule.forChild(...) * You may override the StacheRouteOptions via a route provider to wire lazy components into navigation * ``` * const routes: Routes = [ * { * path: 'lazy', * loadComponent: () => import('./path/to/lazy.component'), * providers: [ * { provide: STACHE_ROUTE_OPTIONS, useValue: {basePath: 'nested'}} * ] * data: { * stache: { * name: 'Lazy', * }, * }, * }, * ]; * ``` */ export declare class StacheRouteService implements OnDestroy { #private; constructor(router: Router, routes?: Routes, options?: StacheRouteOptions); ngOnDestroy(): void; getActiveRoutes(): StacheNavLink[]; getActiveUrl(): string; clearActiveRoutes(): void; static ɵfac: i0.ɵɵFactoryDeclaration<StacheRouteService, [null, { optional: true; }, { optional: true; }]>; static ɵprov: i0.ɵɵInjectableDeclaration<StacheRouteService>; }