@ -72,7 +72,8 @@ export class Location {
|
||||
|
||||
back(): void { this._platformStrategy.back(); }
|
||||
|
||||
subscribe(onNext, onThrow = null, onReturn = null): void {
|
||||
subscribe(onNext: (value: any) => void, onThrow: (exception: any) => void = null,
|
||||
onReturn: () => void = null): void {
|
||||
ObservableWrapper.subscribe(this._subject, onNext, onThrow, onReturn);
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,6 @@ export class LocationStrategy {
|
||||
pushState(ctx: any, title: string, url: string): void { throw _abstract(); }
|
||||
forward(): void { throw _abstract(); }
|
||||
back(): void { throw _abstract(); }
|
||||
onPopState(fn): void { throw _abstract(); }
|
||||
onPopState(fn: (_) => any): void { throw _abstract(); }
|
||||
getBaseHref(): string { throw _abstract(); }
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ export class RouteRegistry {
|
||||
/**
|
||||
* Given a component and a configuration object, add the route to this registry
|
||||
*/
|
||||
config(parentComponent, config: RouteDefinition): void {
|
||||
config(parentComponent: any, config: RouteDefinition): void {
|
||||
config = normalizeRouteConfig(config);
|
||||
|
||||
var recognizer: RouteRecognizer = this._rules.get(parentComponent);
|
||||
@ -61,7 +61,7 @@ export class RouteRegistry {
|
||||
/**
|
||||
* Reads the annotations of a component and configures the registry based on them
|
||||
*/
|
||||
configFromComponent(component): void {
|
||||
configFromComponent(component: any): void {
|
||||
if (!isType(component)) {
|
||||
return;
|
||||
}
|
||||
@ -88,7 +88,7 @@ export class RouteRegistry {
|
||||
* Given a URL and a parent component, return the most specific instruction for navigating
|
||||
* the application into the state specified by the url
|
||||
*/
|
||||
recognize(url: string, parentComponent): Promise<Instruction> {
|
||||
recognize(url: string, parentComponent: any): Promise<Instruction> {
|
||||
var componentRecognizer = this._rules.get(parentComponent);
|
||||
if (isBlank(componentRecognizer)) {
|
||||
return PromiseWrapper.resolve(null);
|
||||
@ -142,7 +142,7 @@ export class RouteRegistry {
|
||||
* Given a normalized list with component names and params like: `['user', {id: 3 }]`
|
||||
* generates a url with a leading slash relative to the provided `parentComponent`.
|
||||
*/
|
||||
generate(linkParams: List<any>, parentComponent): string {
|
||||
generate(linkParams: List<any>, parentComponent: any): string {
|
||||
let url = '';
|
||||
let componentCursor = parentComponent;
|
||||
for (let i = 0; i < linkParams.length; i += 1) {
|
||||
|
@ -196,7 +196,9 @@ export class Router {
|
||||
/**
|
||||
* Subscribe to URL updates from the router
|
||||
*/
|
||||
subscribe(onNext): void { ObservableWrapper.subscribe(this._subject, onNext); }
|
||||
subscribe(onNext: (value: any) => void): void {
|
||||
ObservableWrapper.subscribe(this._subject, onNext);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@ -292,7 +294,7 @@ export class RootRouter extends Router {
|
||||
this.navigate(location.path());
|
||||
}
|
||||
|
||||
commit(instruction): Promise<any> {
|
||||
commit(instruction: Instruction): Promise<any> {
|
||||
return super.commit(instruction)
|
||||
.then((_) => { this._location.go(instruction.accumulatedUrl); });
|
||||
}
|
||||
|
Reference in New Issue
Block a user