How could i restrict a component to load on back press. Actually i have three component A(Normal Component), B(LoginComponent) and C(Otp Verification Component). I'm routing to component B from A on some button click and from B to C to verify user. now after verification done on component C, i want to go back on component 'A', and want to remove component 'B' and 'C' from history so that on back press from browser it does not load 'B'(LoginComponent) and 'C' again. so how could i do this in angularjs 2.
While navigating from components B and C, pass the option replaceUrl:true
to replace B with C in the browser history.
Eg:
//Navigating to state C
this.router.navigate(["/C"], { replaceUrl: true });
Checkout the documentation for replaceUrl
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With