This is angular 2 routing code
<nav> <ul class="nav nav-tabs"> <li role="presentation" class="active"><a routerLink="/dashboard" routerLinkActive="active">Step I</a></li> <li role="presentation"> <a routerLink="/faculty" routerLinkActive="active">Step II</a></li> <li role="presentation"><a routerLink="/heroes" routerLinkActive="active">Step III</a></li> </ul> </nav> <router-outlet></router-outlet>
button click event
clickFunctionEvent(value: any) { this.dataService.setFacultyAnswer(JSON.stringify(value)).subscribe( tradeshows => { this.data= tradeshows //if data=success then redirect to next routerLink like "/faculty" }, error => {console.error('QuestionList:\n\t ' + error);} ); }
if data=success
then redirect to next routerLink like "/faculty"
so how to it in .ts
file
And how to disable previous routerLink so not allow to go back
thanks in advance
Yes it can be attached to div tag, your route is probably wrong try add / in front of route.
you use
//in your constructor constructor(public router: Router){} //navigation link. this.router.navigate(['your-route']);
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