解决办法:
app.module.ts文件添加以下两行代码:
1 2 3 4 5 6 7 8 9 10 11 |
import { LocationStrategy, HashLocationStrategy } from '@angular/common'; @NgModule({ providers: [ { provide: LocationStrategy, useClass: HashLocationStrategy }, ] }) |