在为我的项目实施子路由时,我遇到了以下错误。我在 GitHub 和其他网站上没有找到任何帮助。
错误错误:未捕获(承诺):SecurityError:无法在“历史”上执行“pushState”:无法在具有“ http://%28routes%29/ ”的文档中创建具有 URL“ http://%28routes%29/ ”的历史状态对象:http: //localhost:4200 ' 和 URL ' http://localhost:4200/ '。错误:无法在“历史”上执行“pushState”:无法在来源为“ http://localhost:4200 ”和 URL的文档中创建URL 为“ http://%28routes%29/ ”的历史状态对象http://localhost:4200/ '.
小智 11
我遇到了同样的问题,这是由于路由器链接字符串前面缺少斜杠“/”造成的。更清楚的是,当链接被定义为时,我遇到了问题:
<mat-list-item><a class="mat-h3 menu-link" [routerLink]="['about']">About</a></mat-list-item>
当我更正它时,问题消失了:
<mat-list-item><a class="mat-h3 menu-link" [routerLink]="['/about']">About</a></mat-list-item>
| 归档时间: |
|
| 查看次数: |
1490 次 |
| 最近记录: |