angular6项目打包本地访问路由策略
2022-01-29 11:32:02 来源:admin 点击:585
angular6项目在本地访问正常,部署上去也可以访问,但刷新页面会404
解决办法;使用HashLocationStrategy 路由策略
//app.module.ts
import { HashLocationStrategy, LocationStrategy } from '@angular/common';
@NgModule({
providers: [{ provide: LocationStrategy, useClass: HashLocationStrategy }]
})