0

I am stuck. My situation:

  • Lib UI has an icon component.
  • Lib UI has a modal module.
  • App has a shared module for root.

I want to use the icon in the shared module and this is also needed inside the modal module that I want to use. The icon is used inside a component of the modal.

I get the error that the Icon component is used in the shared and the modal module.

Icon => Imported and exported in Shared module => App

Icon => Imported in Modal module => App

This also doesn't work Modal => Imported and exported in Shared module Does anybody have a suggestion on how I should handle this cyclic reference or double import?

Ron Jonk
  • 706
  • 6
  • 16
  • add Icon component inside declaration array of Modal Module, and then import modal module to UI module, Then Import UI module to shared module and then import shared module to app-module. – GRD Feb 18 '22 at 09:47
  • Thanx for trying this out.. In your example you are importing the icon inside the modal module and then import the modelmodule in the shared. I looks strange to expose the generic icon ui component by importing the modal module – Ron Jonk Feb 18 '22 at 11:54
  • Can you explain more how you want to use icon component – GRD Feb 18 '22 at 16:41
  • So you have three parts 1. Icon-Library 2. Model-Library 3. application. Then you can import icon-library-module iniside app-module, and also import icon-module inside model import too! but icon-component must be inside export of icon-module. – GRD Feb 21 '22 at 07:46
  • The icon I want to use in two different projects from an angular ui-library. The modal (also in the same ui library) I use in one project. The Modal component also uses the icon so I need to import the icon to the modal module. The Icon is exported from the ui-lib and. – Ron Jonk Feb 21 '22 at 07:46
  • No modal library only a ui-library. but inside the ui-library a modal module .. or is this not possible to have a module inside a library? I need a service a directive and a component for the modal to work so I put the directive and component together to a module – Ron Jonk Feb 21 '22 at 07:48
  • wow many thanx for your effort. ill look at it – Ron Jonk Feb 21 '22 at 08:12
  • You are my hero. it works and now I can shorten my list of imports – Ron Jonk Feb 21 '22 at 08:43

0 Answers0