方向url其他类型用户

Direction url other type users

我正在制作一个网页,有不同类型的 users.Dealer 和 worker.Only 工人可以访问 index.html 页面,只有经销商可以访问 odeme.html.I 做了这个。 index.html=http://localhost:8080 odeme.html=http://localhost:8080/odeme

我是经销商,在 odeme.html 页面上,如果我更改 url,我可以访问 index.html。我通过 ajax 调用解决了这个问题,并且location.href.But 第一个索引页出现然后 odeme.html appears.I 想要 odeme.html 页面出现而没有索引页 displayed.How 我可以吗?

尝试为您的应用中的每个角色使用保护。

Read more here about Router CanActivate

您还可以找到完整的实现 here