Skip to content

Commit

Permalink
fix(ns-router-link): navigate with urlTree
Browse files Browse the repository at this point in the history
closes #724
  • Loading branch information
sis0k0 committed Mar 29, 2017
1 parent bcde968 commit 6b5ad01
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions nativescript-angular/router/ns-router-link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,21 +76,19 @@ export class NSRouterLink implements OnChanges { // tslint:disable-line:directiv
JSON.stringify(this.pageTransition));

const extras = this.getExtras();
this.navigator.navigate(this.commands, extras);
this.navigator.navigateByUrl(this.urlTree, extras);
}

private getExtras() {
private getExtras(): NavigationExtras & NavigationOptions {
const transition = this.getTransition();
const extras: NavigationExtras & NavigationOptions = {
return {
queryParams: this.queryParams,
fragment: this.fragment,
clearHistory: this.clearHistory,
animated: transition.animated,
transition: transition.transition,
relativeTo: this.currentRoute,
};

return (<any>Object).assign(extras,
this.currentRoute.toString() !== "Route(url:'', path:'')" && this.currentRoute);
}

private getTransition(): { animated: boolean, transition?: NavigationTransition } {
Expand Down

0 comments on commit 6b5ad01

Please sign in to comment.