这是我的函数,它指向页面路由
.ts文件
readmoreFunc(data:any){
this.showId = data._id;
this.contentType =data.type
this.router.navigate(['/dashboard/dashboard-content/', this.showId,this.contentType])}
showId和contentType是我的参数。例如";(http://localhost:4200/dashboard/dashboard-content/ckhewcmcj000v98t9zcb89rz/Recent Post(我想在chrome的另一个选项卡中打开它。
试试这个,
const url = this.router.serializeUrl(
this.router.createUrlTree([`/dashboard/dashboard-content/${this.showId}/${this.contentType}`])
);
window.open(url, '_blank');