问题:在使用angular中的router-outlet进行路由跳转时出错,系统提示
ERROR Error: Uncaught (in promise): Error: Cannot match any routes. URL Segment:

产生原因:在基本路由中,<a routerLink="/first-component" >First Component</a>可以正常访问,但在嵌套路由中,就会报错。

解决办法:使用嵌套路由时需要去掉<a routerLink="/first-component" >First Component</a>中的斜杠 /,将其变成<a routerLink="first-component" >First Component</a>

参考文档:https://angular.cn/guide/router#nesting-routes

我的网站:https://www.wa2000.net

Logo

昇腾计算产业是基于昇腾系列(HUAWEI Ascend)处理器和基础软件构建的全栈 AI计算基础设施、行业应用及服务,https://devpress.csdn.net/organization/setting/general/146749包括昇腾系列处理器、系列硬件、CANN、AI计算框架、应用使能、开发工具链、管理运维工具、行业应用及服务等全产业链

更多推荐