angular - 在控制台上获取错误数据
问题描述
我只是将一些数据作为 url 传递并尝试从 URL 控制下一页。但是在错误的变量中获取数据。
供应商-action.component.html
<tr mat-header-row *matHeaderRowDef="['nVendorId','change_column','change_type','Timestamp','status','requestid']"></tr>
<tr class="rowhover" (click)="displayData(row.change_column,row.nVendorId,row.requestid)" mat-row *matRowDef="let row; columns: ['nVendorId','change_column','change_type','Timestamp','status','requestid']"></tr>
供应商-action.component.ts
displayData(col,id,rid)
{
this.router.navigate(["/home/vendor-action/approval",col,id,rid]);
}
批准.component.ts
ngOnInit()
{
this.col=this.activatedRoute.snapshot.paramMap.get('col');
this.id=this.activatedRoute.snapshot.paramMap.get('id');
this.rid=this.activatedRoute.snapshot.paramMap.get('rid');
console.log(this.col);
console.log(this.id);
console.log(this.rid);
}
我在“col”中得到“rid”的值,在“id”中得到“col”,在“rid”中得到“null”。为什么会这样。这有什么问题吗?
解决方案
在您的路由信息中添加这 3 个变量
推荐阅读
- javascript - 无法在未安装的组件上调用 setState(或 forceUpdate)。这是一个无操作,但它表明您的应用程序中存在内存泄漏
- product - 两种产品,不同的到货时间,Anylogic
- asp.net-mvc - 在.NET MVC 中使用@Ajax.BeginForm 上传图片?
- swift - 让 Sprite 慢慢向触摸方向移动
- python-3.x - Create a line graph per bin in Python 3
- python-3.x - "NameError: name 'datetime' is not defined" with datetime imported
- python - 鉴于该列包含循环中的数据,重命名数据框中的列
- python - Python发送16进制数据,高效存储
- laravel - 在 Laravel 5.6 中获取当前类别的详细信息
- php - 如果我在 codeigniter 框架中使用重定向,我可以传递数据来查看吗?