我有一个组件,在点击按钮时需要向另一个组件传递数据,因此我在锚点中使用了[routerLink]
属性,如下所示:
<a [routerLink]="['/employeedetail' , name, address,
detail3 , detail4, detail5, detail6 , detail7, detail8 ,
detail9, detail10></a>
在 app.route.ts 中定义了相应的路由。
{
path: 'employeedetail/:name/:address/:detail3 /:detail4
/:detail5 /:detail6/:detail7 /:detail8 /:detail9 /:detail10 ',
component : employeedetailComponent
}
在完美的世界中,它应该可以工作,但是实际上它不能,因为会出现错误,错误信息如下:
我对此进行了研究,并发现当内联模板中有10个元素时,angular2路由器会失败。我通过删除URL中的最后一个参数(detail10)来尝试解决问题,然后没有出现错误。zone.js:355Unhandled Promise rejection: Unsupported number of argument for pure functions: 11 ; Zone: ; Task: Promise.then ; Value: Error: Unsupported number of argument for pure functions: 11(…) Error: Unsupported number of argument for pure functions: 11
问题是如何使用[routerlink]传递这些大量的参数,或者我应该使用不同的方法来从一个组件传递数据到另一个组件?