fix(router): routerLinkActive should only set classes after the router has successfully navigated

This commit is contained in:
vsavkin
2016-07-20 17:51:21 -07:00
parent eb6ff65af7
commit db54a84d14
10 changed files with 69 additions and 4 deletions

View File

@ -94,7 +94,7 @@ export class RouterLinkActive implements OnChanges, OnDestroy, AfterContentInit
ngOnDestroy(): any { this.subscription.unsubscribe(); }
private update(): void {
if (!this.links || !this.linksWithHrefs) return;
if (!this.links || !this.linksWithHrefs || !this.router.navigated) return;
const currentUrlTree = this.router.parseUrl(this.router.url);
const isActiveLinks = this.reduceList(currentUrlTree, this.links);