DEV Community

Discussion on: Why Your Angular App Is Not Working: 7 Common Mistakes

Collapse
 
anduser96 profile image
Andrei Gatej

Thank you for the article!

Referring to #5, wouldn’t it be more recommended to put your component in the shared module?

Collapse
 
valeriopisapia profile image
Valerio

Well, I would say that it depends on the component.
For example, if you need the Alert Component in the whole application, I'd add it to the App module.
What do you think?

Collapse
 
anduser96 profile image
Andrei Gatej

I’m not sure it would be accessible in feature modules as you need to declare it in their module. In order to avoid that error that you cannot declare the same component in more than one module, I’d use a shared module.

Thread Thread
 
valeriopisapia profile image
Valerio

Yes you're right.
As I said before it depends on the context.
The best suggestion is to declare a module once.