Angular 4 个组件在部署时未正确路由
Angular 4 components are not routing correctly when deployed
我使用 NPM 模块加载我的 Angular 4 应用程序,它在本地主机上默认运行:4200
我使用路由功能在我的应用程序中导航我的组件,在部署我的应用程序之前它工作正常但在部署应用程序之后它运行页面未找到错误,这种类型的错误仅在我刷新页面时显示。
When I reload the page it was shown like this:
我通过添加
解决了这个问题
providers: [ {provide: LocationStrategy, useClass: HashLocationStrategy} ]
在app.module.ts
感谢那些试图解决我的问题的人 :)
我使用 NPM 模块加载我的 Angular 4 应用程序,它在本地主机上默认运行:4200
我使用路由功能在我的应用程序中导航我的组件,在部署我的应用程序之前它工作正常但在部署应用程序之后它运行页面未找到错误,这种类型的错误仅在我刷新页面时显示。 When I reload the page it was shown like this:
我通过添加
解决了这个问题providers: [ {provide: LocationStrategy, useClass: HashLocationStrategy} ]
在app.module.ts
感谢那些试图解决我的问题的人 :)