Shiwangi Gaur
Shiwangi Gaur

Reputation: 83

Load CSS Module Wise in Angular

Here is the scenario -

I have multiple modules in my angular application. Ex -

app.module.ts
    student.module.ts
        component A
        component B
        component C
    admin.module.ts
        component A
        component B
        component C
    .
    .
    .

As per the above hierarchy , I have two new modules(student & admin) and each module has separate components.

Now I want to load CSS file module wise so that it can be apply on all components of that module , not outside that module.

If I call CSS file in style.css then it will be apply globally which I don't want.

So is there any way to do this because I don't want to write CSS in each component's css file because it is common for specific module's components.

Upvotes: 1

Views: 314

Answers (1)

Doflamingo19
Doflamingo19

Reputation: 1639

I don't now if it work but you try this:

Put this in your component:

 import 'path/folder/module.css';

Put the .css path in this import

Upvotes: 0

Related Questions