3.1 动态路由的js跳转
1.在路由中配置动态路由path:'productcontent/:pid',2.配置相对应的事件<button (click)="goProductcontent()">js跳转路由</button>3.导入路由跳转模块import { Router } from '@angular/router'4.声明(实例化)constructor(public router:Router) { }5.跳转goProductcontent(){this.router.navigate(['/productcontent/','1234'])}
3.2 js普通跳转
1.配置相对应的事件<button (click)="gohomes()">js跳转路由</button>2.导入路由跳转模块import { Router } from '@angular/router'3.声明(实例化)constructor(public router:Router) { }4.跳转gohomes(){this.router.navigate(['/homes'])}
