Nativescript-angular: NavigationExtras with RouterExtensions + clearHistory?

Created on 29 Dec 2016  路  4Comments  路  Source: NativeScript/nativescript-angular

I want to pass the data to another page while navigating. for that, I was using

this.router.navigate(["/SignatureOptionVC"], navigationExtras);

But then, I needed to clear the back-stack/history as well, so I found that I can navigate through
RouterExtensionswith clearHistory: true flag. But it seems it doesn't support navigationExtras.

Is there any way I can clear history + pass navigationExtras?

question

Most helpful comment

Hi @sam0829

You can pass multiple navigation options like this:

this.routerExtensions.navigate(["/first"], {
    clearHistory: true,
    transition: {
        name: "flip",
        duration: 2000,
        curve: "linear"
    }
});

More about navigation option in NG+Angular-2 here

All 4 comments

Hi @sam0829

You can pass multiple navigation options like this:

this.routerExtensions.navigate(["/first"], {
    clearHistory: true,
    transition: {
        name: "flip",
        duration: 2000,
        curve: "linear"
    }
});

More about navigation option in NG+Angular-2 here

@NickIliev thanks for your quick reply, I'll try this & close the question. Thanks again :)

@NickIliev I want to pass data from one screen to another while using routerExtensions.navigate()
If I looked correct, then it only supports following :

clearHistory?: boolean; animated?: boolean; transition?: NavigationTransition;

But I want clearHistory + data passing.

Is there any way to achieve this using routerExtensions?

because my main problem is I want to cleat the back stack while navigating & at the same time I want to pass the data to the page I am navigating

@sam0829 passing context within pages differs from vanilla NativeScript.
Here you can find the documentation article about passing parameters and here you can find a sample which is using the native API but the logic is the same with the wrapped PageRoute instead of the @angular ActivatedRoute

Was this page helpful?
0 / 5 - 0 ratings