Custom selector component css not working outside global.css

Ionic 4, I’ve got a few custom components, I can’t get the styles to work on the selector if I add them to the component scss file

on “phone-input.component.scss” does not work:

phone-input{
  background: red;
}

if I add to “global.scss” it does work

phone-input{
  background: red;
}

answering this in case anyone runs into this.

to apply style to the selector tag you can use:

“:host {}” instead of “tag-name {}”

what do you mean with “host”?

this:

1 Like

Cool thanks, never used it before.

So with Ionic 3:
my-component {}

Ionic +4:
:host {}

2 Likes