项目中遇到此问题,研究了很久。最终解决,一开始以为是路由配置错误。
在app.module.ts中添加,import { LocationStrategy, HashLocationStrategy } from '@angular/common';
在providers位置添加 { provide: LocationStrategy, useClass: HashLocationStrategy }
项目中遇到此问题,研究了很久。最终解决,一开始以为是路由配置错误。
在app.module.ts中添加,import { LocationStrategy, HashLocationStrategy } from '@angular/common';
在providers位置添加 { provide: LocationStrategy, useClass: HashLocationStrategy }