DEV Community

loading...

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

Collapse
valeriopisapia profile image
Valerio Author

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 Author

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