angular-docs-cn/tools/public_api_guard/router/index.d.ts

289 lines
7.9 KiB
TypeScript
Raw Normal View History

2016-06-28 17:49:29 -04:00
/** @stable */
export declare class ActivatedRoute {
component: Type | string;
data: Observable<Data>;
outlet: string;
params: Observable<Params>;
snapshot: ActivatedRouteSnapshot;
url: Observable<UrlSegment[]>;
toString(): string;
}
2016-06-28 17:49:29 -04:00
/** @stable */
export declare class ActivatedRouteSnapshot {
component: Type | string;
data: Data;
outlet: string;
params: Params;
url: UrlSegment[];
toString(): string;
}
2016-06-28 17:49:29 -04:00
/** @stable */
export interface CanActivate {
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> | Promise<boolean> | boolean;
}
/** @stable */
export interface CanActivateChild {
canActivateChild(childRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> | Promise<boolean> | boolean;
}
2016-06-28 17:49:29 -04:00
/** @stable */
export interface CanDeactivate<T> {
canDeactivate(component: T, route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> | Promise<boolean> | boolean;
}
2016-07-26 17:39:02 -04:00
/** @stable */
export interface CanLoad {
canLoad(route: Route): Observable<boolean> | Promise<boolean> | boolean;
}
2016-06-28 17:49:29 -04:00
/** @stable */
export declare type Data = {
[name: string]: any;
};
/** @experimental */
export declare class DefaultUrlSerializer implements UrlSerializer {
parse(url: string): UrlTree;
serialize(tree: UrlTree): string;
}
2016-06-28 17:49:29 -04:00
/** @stable */
export declare type Event = NavigationStart | NavigationEnd | NavigationCancel | NavigationError;
/** @experimental */
export interface ExtraOptions {
enableTracing?: boolean;
useHash?: boolean;
}
2016-06-28 17:49:29 -04:00
/** @stable */
export declare class NavigationCancel {
id: number;
url: string;
constructor(id: number, url: string);
toString(): string;
}
2016-06-28 17:49:29 -04:00
/** @stable */
export declare class NavigationEnd {
id: number;
url: string;
urlAfterRedirects: string;
constructor(id: number, url: string, urlAfterRedirects: string);
toString(): string;
}
2016-06-28 17:49:29 -04:00
/** @stable */
export declare class NavigationError {
error: any;
id: number;
url: string;
constructor(id: number, url: string, error: any);
toString(): string;
}
2016-07-18 19:42:33 -04:00
/** @experimental */
export interface NavigationExtras {
fragment?: string;
preserveFragment?: boolean;
preserveQueryParams?: boolean;
2016-07-18 19:42:33 -04:00
queryParams?: Params;
relativeTo?: ActivatedRoute;
}
2016-06-28 17:49:29 -04:00
/** @stable */
export declare class NavigationStart {
id: number;
url: string;
constructor(id: number, url: string);
toString(): string;
}
/** @experimental */
export declare type Params = {
[key: string]: any;
};
/** @experimental */
export declare const PRIMARY_OUTLET: string;
/** @experimental */
2016-07-06 19:19:52 -04:00
export declare function provideRouter(config: Routes, opts?: ExtraOptions): any[];
/** @deprecated */
2016-07-06 19:19:52 -04:00
export declare function provideRouterConfig(config: ExtraOptions): any;
/** @deprecated */
2016-07-06 19:19:52 -04:00
export declare function provideRoutes(routes: Routes): any;
2016-07-06 14:02:52 -04:00
/** @experimental */
export interface Resolve<T> {
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<any> | Promise<any> | any;
}
2016-06-28 17:49:29 -04:00
/** @stable */
export declare type ResolveData = {
[name: string]: any;
};
2016-06-28 17:49:29 -04:00
/** @stable */
export interface Route {
path?: string;
pathMatch?:
/** @deprecated */ terminal?: boolean;
2016-06-28 17:49:29 -04:00
/** @stable */
export declare class Router {
events: Observable<Event>;
/** @experimental */ navigated: boolean;
routerState: RouterState;
url: string;
constructor(rootComponentType: Type, resolver: ComponentResolver, urlSerializer: UrlSerializer, outletMap: RouterOutletMap, location: Location, injector: Injector, loader: NgModuleFactoryLoader, config: Routes);
createUrlTree(commands: any[], {relativeTo, queryParams, fragment, preserveQueryParams, preserveFragment}?: NavigationExtras): UrlTree;
dispose(): void;
initialNavigation(): void;
navigate(commands: any[], extras?: NavigationExtras): Promise<boolean>;
navigateByUrl(url: string | UrlTree): Promise<boolean>;
parseUrl(url: string): UrlTree;
2016-07-06 19:19:52 -04:00
resetConfig(config: Routes): void;
serializeUrl(url: UrlTree): string;
}
/** @stable */
export declare const ROUTER_DIRECTIVES: (typeof RouterOutlet | typeof RouterLink | typeof RouterLinkWithHref | typeof RouterLinkActive)[];
2016-07-06 19:19:52 -04:00
/** @deprecated */
export declare type RouterConfig = Route[];
/** @stable */
export declare class RouterLink {
fragment: string;
preserveFragment: boolean;
preserveQueryParams: boolean;
queryParams: {
[k: string]: any;
};
routerLink: any[] | string;
urlTree: UrlTree;
constructor(router: Router, route: ActivatedRoute, locationStrategy: LocationStrategy);
onClick(button: number, ctrlKey: boolean, metaKey: boolean): boolean;
}
/** @stable */
export declare class RouterLinkActive implements OnChanges, OnDestroy, AfterContentInit {
links: QueryList<RouterLink>;
linksWithHrefs: QueryList<RouterLinkWithHref>;
routerLinkActive: string[] | string;
constructor(router: Router, element: ElementRef, renderer: Renderer);
ngAfterContentInit(): void;
ngOnChanges(changes: {}): any;
ngOnDestroy(): any;
}
/** @stable */
export declare class RouterLinkWithHref implements OnChanges, OnDestroy {
fragment: string;
href: string;
preserveFragment: boolean;
preserveQueryParams: boolean;
queryParams: {
[k: string]: any;
};
routerLink: any[] | string;
routerLinkOptions: {
preserveQueryParams: boolean;
preserveFragment: boolean;
};
target: string;
urlTree: UrlTree;
constructor(router: Router, route: ActivatedRoute, locationStrategy: LocationStrategy);
ngOnChanges(changes: {}): any;
ngOnDestroy(): any;
onClick(button: number, ctrlKey: boolean, metaKey: boolean): boolean;
}
2016-07-07 17:13:32 -04:00
/** @experimental */
export declare class RouterModule {
constructor(injector: Injector);
static forChild(routes: Routes): ModuleWithProviders;
static forRoot(routes: Routes, config?: ExtraOptions): ModuleWithProviders;
}
/** @stable */
export declare class RouterOutlet {
activateEvents: EventEmitter<any>;
activatedRoute: ActivatedRoute;
component: Object;
deactivateEvents: EventEmitter<any>;
isActivated: boolean;
outletMap: RouterOutletMap;
2016-07-06 14:02:52 -04:00
constructor(parentOutletMap: RouterOutletMap, location: ViewContainerRef, resolver: ComponentFactoryResolver, name: string);
activate(activatedRoute: ActivatedRoute, loadedResolver: ComponentFactoryResolver, loadedInjector: Injector, providers: ResolvedReflectiveProvider[], outletMap: RouterOutletMap): void;
deactivate(): void;
}
2016-06-28 17:49:29 -04:00
/** @stable */
export declare class RouterOutletMap {
registerOutlet(name: string, outlet: RouterOutlet): void;
}
2016-06-28 17:49:29 -04:00
/** @stable */
export declare class RouterState extends Tree<ActivatedRoute> {
fragment: Observable<string>;
queryParams: Observable<Params>;
snapshot: RouterStateSnapshot;
toString(): string;
}
2016-06-28 17:49:29 -04:00
/** @stable */
export declare class RouterStateSnapshot extends Tree<ActivatedRouteSnapshot> {
fragment: string;
queryParams: Params;
url: string;
toString(): string;
}
2016-07-06 19:19:52 -04:00
/** @stable */
export declare type Routes = Route[];
2016-06-28 17:49:29 -04:00
/** @stable */
export declare class RoutesRecognized {
id: number;
state: RouterStateSnapshot;
url: string;
urlAfterRedirects: string;
constructor(id: number, url: string, urlAfterRedirects: string, state: RouterStateSnapshot);
toString(): string;
}
2016-06-28 17:49:29 -04:00
/** @stable */
export declare class UrlSegment {
parameters: {
[key: string]: string;
};
path: string;
constructor(path: string, parameters: {
[key: string]: string;
});
toString(): string;
}
/** @experimental */
export declare abstract class UrlSerializer {
abstract parse(url: string): UrlTree;
abstract serialize(tree: UrlTree): string;
}
2016-06-28 17:49:29 -04:00
/** @stable */
export declare class UrlTree {
fragment: string;
queryParams: {
[key: string]: string;
};
root: UrlSegmentGroup;
toString(): string;
}