Reputation: 197
I've searched all the way through the web to find an answer but i got nothing..so..here we are
I'm probably fairly new with pure angular. I have mostly used with the ionic framework and the ionic CLI that always did all the things i needed.
I'm now creating a new angular 6 project and I've instantly noticed that CSS/SCSSfile stored in the same folder of the component.ts is not loaded automatically.
I have to use the "styleUrls" property for components but i never needed that when working with ionic 3/angular. I know this is a "nosense" problem...but i'm worried that i missed something when dealing with the cli/configuration
Can you tell me if this is the intended behavior? Was it ionic that did that of auto loading css file relative to the component in the same folder trick?
Upvotes: 0
Views: 577
Reputation: 2650
This is intended behavior. It's not required that the styleUrls
@Component property is filled out, but having styles defined in this way does have it's benefits. If it is not filled out, any global styles that your application has will still be applied to the component, but you will lose out on a nice feature called view encapsulation, which makes your component styles scoped to the component that has it defined, making style updates easier to maintain.
Upvotes: 1