vendredi 7 octobre 2016

Angular 2 testing Router with Jasmine and Karma

I am having issues writing a stub for router.navigate in angular 2. I currently have the below stub written. Which is what shows up in the angular docs.

@Injectable
export class RouterStub {
    navigate(commands: any[], extras?: NavigationExtras) { }

However, when I use this stub I get the following error.

TypeError: this.router.navigate is not a function 

And my usage of navigate is as follows.

let summaryLink = ['/summary', this.client.id, this.client.lastName];
this.router.navigate(summaryLink);

Any help would be appreciated.

Aucun commentaire:

Enregistrer un commentaire