[英]angular route path with parameters separated with &
This type of path is not working: 这种类型的路径不起作用:
{ path: 'account/finalize?user=:user&token=:token', component: MyComponent }
I get route not found error when I access http://localhost:4200/account/finalize?user=devanshu&token=122323 访问http:// localhost:4200 / account / finalize时出现找不到路由的错误消息?user = devanshu&token = 122323
But this is working: 但这是可行的:
{ path: 'account/finalize/:school/:token', component: MyComponent }
So, I can access http://localhost:4200/account/finalize/devanshu/122323 因此,我可以访问http:// localhost:4200 / account / finalize / devanshu / 122323
What is the problem here? 这里有什么问题? Why is there an error in the first case?
为什么在第一种情况下出现错误?
you can use 您可以使用
path: 'account/finalize'
and send user and token as query Params when navigating 并在导航时将用户和令牌发送为查询参数
this.router.navigate(['/account/finalize'], { queryParams: { user: 'user', token: 'your token' } });
I think you do not need to pass these parameters: user=:user&token=:token
我认为您不需要传递以下参数:
user=:user&token=:token
You can get these parameters in the req.body
您可以在
req.body
获得这些参数
And if there is any particular component then you have to place the condition within the function. 并且,如果有任何特定的组件,则必须将条件放置在函数中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.