0
如果我有绑定到特定路由的组件(假设OrdersListComponent绑定到/ orders /:userId)。Angular 4 - 获取routeparms作为@input
如果我理解正确,为了recive组件内的userId,我需要在构造函数中使用this.route.snapshot.params.userId。 当我想在另一个组件中使用这个组件时,这种情况会引起我的注意,在这种情况下,我将在@input()绑定中收回它。
有没有更好的方法来做到这一点?
UIRouter支持将路由参数映射到输入。 https://ui-router.github.io/ – cgTag