【angular】angualr中實現js跳轉路由
阿新 • • 發佈:2019-01-28
1.引入
import{Router}from'@angular/router';2.初始化
exportclassHomeComponentimplementsOnInit{ constructor(private router:Router){} ngOnInit(){} goNews(){// this.router.navigate(['/news', hero.id]);this.router.navigate(['../exammode-detail'],{relativeTo:this.route} }}
3.路由跳轉
import在routes.ts中則為