fix(router): create custom ResolvedInstruction class

This commit is contained in:
Adam Bradley
2015-12-08 22:00:55 -06:00
parent 30b88d746b
commit ec0c146be6

View File

@@ -84,8 +84,8 @@ export class NavRouter extends RouterOutlet {
// generate a componentInstruction from the view's PathRecognizer and params
let componentInstruction = pathRecognizer.generate(viewCtrl.params.data);
// create an Instruction from the componentInstruction
let instruction = new Instruction(componentInstruction, null);
// create a ResolvedInstruction from the componentInstruction
let instruction = new ResolvedInstruction(componentInstruction, null);
this._parentRouter.navigateByInstruction(instruction);
}
@@ -113,3 +113,16 @@ export class NavRouter extends RouterOutlet {
}
}
// TODO: hacked from
// https://github.com/angular/angular/blob/6ddfff5cd59aac9099aa6da5118c5598eea7ea11/modules/angular2/src/router/instruction.ts#L207
class ResolvedInstruction extends Instruction {
constructor(public component: ComponentInstruction, public child: Instruction,
public auxInstruction: {[key: string]: Instruction}) {
super();
}
resolveComponent(): Promise<ComponentInstruction> {
return Promise.resolve(this.component);
}
}