【发布时间】:2018-08-02 00:51:41
【问题描述】:
有人能帮帮我吗?我使用 Angular 5。当我导航到 this.router.navigate(['somePath']); 之类的路线时,我在浏览器中的 url 更改为 basicUrl/somePath。一切正常,直到页面在浏览器中重新加载。之后我看到了我的组件(没有导航栏和其他东西,只有我的组件 html)。我该如何改善这种行为?现在我的每个组件都有
ngOnInit() {
this.location.replaceState('/');
}
替换浏览器网址。但我不喜欢这种解决方案。
【问题讨论】:
-
看看
HashLocationStrategy -
请发布您的主要路由文件。
标签: angular navigation reload