Reputation: 4814
First of all i tried with this answers but not found my solution: Similar question
Let me expalin how i implemented:
forgot-password
& new-password
email verification link
.link
ngOnInit
ajax
call will go.or
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
BrowserAnimationsModule
in my
app.module.ts the routing is working fine.But I need thisBrowserAnimationsModule
.! what is the alternate solution. routing
is working fine.Upvotes: 1
Views: 793
Reputation: 43
For me
setTimeout(() => {
this.router.navigate(['']);
}, 0);
did the trick
Upvotes: 1
Reputation: 563
Update to lastest version of Angular
Also, try :
if(result.data == "failure") {
// failure no data
}
else {
// success data
this.zone.run(() =>{
this._router.navigate(['new-password']);
});
}
Upvotes: 4
Reputation: 527
Instead of navigating to new-password from forgot-password ts file,you can give the route link of your new password page in your email verification link
,and in constructor of new password component you can use your ajax call,on success of that open new password page and in error case navigate to the error page.
Upvotes: 0