UNPKG

2.54 kBTypeScriptView Raw
1import { Type } from '../src/facade/lang';
2import { OpaqueToken } from '@angular/core';
3import { RouteDefinition } from './route_config/route_config_impl';
4import { Instruction } from './instruction';
5/**
6 * Token used to bind the component with the top-level {@link RouteConfig}s for the
7 * application.
8 *
9 * ### Example ([live demo](http://plnkr.co/edit/iRUP8B5OUbxCWQ3AcIDm))
10 *
11 * ```
12 * import {Component} from '@angular/core';
13 * import {
14 * ROUTER_DIRECTIVES,
15 * ROUTER_PROVIDERS,
16 * RouteConfig
17 * } from '@angular/router-deprecated';
18 *
19 * @Component({directives: [ROUTER_DIRECTIVES]})
20 * @RouteConfig([
21 * {...},
22 * ])
23 * class AppCmp {
24 * // ...
25 * }
26 *
27 * bootstrap(AppCmp, [ROUTER_PROVIDERS]);
28 * ```
29 */
30export declare const ROUTER_PRIMARY_COMPONENT: OpaqueToken;
31/**
32 * The RouteRegistry holds route configurations for each component in an Angular app.
33 * It is responsible for creating Instructions from URLs, and generating URLs based on route and
34 * parameters.
35 */
36export declare class RouteRegistry {
37 private _rootComponent;
38 private _rules;
39 constructor(_rootComponent: Type);
40 /**
41 * Given a component and a configuration object, add the route to this registry
42 */
43 config(parentComponent: any, config: RouteDefinition): void;
44 /**
45 * Reads the annotations of a component and configures the registry based on them
46 */
47 configFromComponent(component: any): void;
48 /**
49 * Given a URL and a parent component, return the most specific instruction for navigating
50 * the application into the state specified by the url
51 */
52 recognize(url: string, ancestorInstructions: Instruction[]): Promise<Instruction>;
53 /**
54 * Recognizes all parent-child routes, but creates unresolved auxiliary routes
55 */
56 private _recognize(parsedUrl, ancestorInstructions, _aux?);
57 private _auxRoutesToUnresolved(auxRoutes, parentInstructions);
58 /**
59 * Given a normalized list with component names and params like: `['user', {id: 3 }]`
60 * generates a url with a leading slash relative to the provided `parentComponent`.
61 *
62 * If the optional param `_aux` is `true`, then we generate starting at an auxiliary
63 * route boundary.
64 */
65 generate(linkParams: any[], ancestorInstructions: Instruction[], _aux?: boolean): Instruction;
66 private _generate(linkParams, ancestorInstructions, prevInstruction, _aux, _originalLink);
67 hasRoute(name: string, parentComponent: any): boolean;
68 generateDefault(componentCursor: Type): Instruction;
69}
70
\No newline at end of file