First of all i tried with this answers but not found my solution: Similar question
Let me expalin how i implemented:
- I have two components
forgot-password
&new-password
- When the user submit forgot password form he will get a
email verification link
. - when user clicks that email
link
- it will go to forgot-password.ts file and then in
ngOnInit
ajax
call will go. - From ajax response if success data it will redirect to the new-password
or
- it will throw the error in frogot password page itself
My issue:
when I try to navigate to new-password from forgot-password ts file after ajax response using the external link (Gmail
link) ; it
appends component data instead of replacing the forgot with new component.
My app.moduel.ts:
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
@NgModule({
imports: [
BrowserAnimationsModule,
})
And this my route code forgot-password.ts :
if(result.data == "failure") {
// failure no data
}
else {
// success data
this._router.navigate(['new-password']);
}
NOTE
- When I comment these
BrowserAnimationsModule
in my app.module.ts the routing is working fine.But I need thisBrowserAnimationsModule
.! what is the alternate solution. - If not form external link(Gmail) the
routing
is working fine.