0

How can I make this style available to child components?

.invalid {
  border-color: #dd2c00;
}

Is it possible to make an entire component's style sheet available to child components?

coder
  • 239
  • 2
  • 3
  • 14
  • https://stackoverflow.com/questions/36527605/style-child-components-from-parent-components-css-file – Hagai Wild Dec 23 '18 at 11:34
  • 1
    Possible duplicate of [Style child components from parent component's CSS file](https://stackoverflow.com/questions/36527605/style-child-components-from-parent-components-css-file) – JoSSte Dec 23 '18 at 11:36
  • answers in there are deprecated – coder Dec 23 '18 at 11:36

1 Answers1

1

Regarding your class, add ::ng-deep in front of it and you'll be fine.

::ng-deep .invalid {
  border-color: #dd2c00;
}

As for your other question:

Is it possible to make an entire component's style sheet available to child components?

You can change the component's ViewEncapsulation property to Native or None

@Component({
  ...
  encapsulation: ViewEncapsulation.None
  ...
})
benshabatnoam
  • 7,161
  • 1
  • 31
  • 52