7
TS文件這是角2路由代碼如何重定向或撥打routerlink在angular2
<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>
按鈕點擊事件
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);}
);
}
如果data=success
然後重定向到下一個routerLink像"/faculty"
所以如何在.ts
檔案
和how to disable previous routerLink so not allow to go back
在此先感謝
請分享文檔的鏈接,以及 –