angular+ionic项目打包后,访问页面空白。错误信息Error: Cannot match any routes. URL Segment: ‘index.html‘ at t.value

项目中遇到此问题,研究了很久。最终解决,一开始以为是路由配置错误。

在app.module.ts中添加,import { LocationStrategy, HashLocationStrategy } from '@angular/common';

在providers位置添加 { provide: LocationStrategy, useClass: HashLocationStrategy } 

猜你喜欢

转载自blog.csdn.net/xiaoxiaoyang007/article/details/112002231