No provider for TreeDraggedElement 报错问题

  官网后台管理,有个树结构要展示,之前用过 angular-tree-component,直接拿过来用

  说下文件结构:

 

 

   系统模块里的功能模块,用到了 share 模块里的  ros-tree 树组件,share 中也 import 了 对应的 TreeModule,并且 system 也引入了 shareModule :

 

 

 

   在5中,这样的引用是没问题的,而且树组件会正常显示,但是到了9,报了个错误:No provider for TreeDraggedElement !

 

 

   百度查了一下:https://stackoverflow.com/questions/57306772/create-singleton-services-in-app-module-but-initialize-components-in-feature-mod

 

   大致意思就是,根模块要引入 TreeModule.forRoot(),其他用到树组件的地方则需要引入 TreeModule 

  shareModule 加上 TreeModule.forRoot(), systemModule 加上 TreeModule ,再跑果然没错误了~

 

posted @ 2020-06-29 15:36  名字不好起啊  阅读(316)  评论(0编辑  收藏  举报