1

I have two modules one Core module,another Shared module.

Core module contains application wide singleton services and component which are loaded intially such as login,navbar.

Shared module contains reusable components,pipe and services.Also it import material module.

Now in core module we have login and navbar components which requires material module.And material module is imported in shared module.So I need to import shared module in core module. But according to Angular guideline we should not import shared module in core.

So how can I resolve this issue to avoid importing shared module in core module.

1 Answer 1

1

Using a modular approach and lazy loading the modules. It is best to import into each feature module the necessary components/module needed for that feature.

For your case, in core module, you can just import the necessary material items needed to get your nav bar and login to work without the entire overhead of everything in the material module (or shared module) being loaded in core.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for your answer.That is best way to avoid shared module bieng imported in core

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.