ERROR in Cannot use 'in' operator to search for 'providers' in null 出现这个问题的原因是,在使用懒加载的时候,没有指定module,没有找到相关的提供信息。
const routes: Routes = [
{path:'login',component:loginComponent},
{ path: 'about', loadChildren: './home/home/home.module'},]
以上是修改之前报错的代码:
以下是修改之后不报错的代码,只需要给其指定一module:
const routes: Routes = [
{path:'login',component:loginComponent},
{ path: 'about', loadChildren: './home/home/home.module#AboutModule'},]
这样即可!
本人由于还是在学习阶段,欢迎讨论!
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有