NativeScript / Angular router clearHistory issue


#1

I have an issue with a flow im creating for android where user fills a certain form and presses the send button when done.
when the button is pressed the data is sent to the server and the router.navigate is set to main page.
my issue is that i am trying to clear history so the user won’t be able to return to the form but what actually happens is that when the device back button is pressed the user returns to the form page with all the info still filled in.

tried already:
this.router.navigate([main],{clearHistory: true});
this.router.navigate([main], {clearHistory: true});
i am open to any possible solution !

thanks


#2

If you’d use the back feature of the router that page would be removed from the stack and no back button would be visible.

YourClass {
  constructor(private routerExtensions: RouterExtensions) {
  }

  yourSaveFunction(): void {
    // save logic here

    this.routerExtensions.back()
  }
}

#3

Works like a charm!! thanks alot @Eddy