coder
coder

Reputation: 357

How to make a style or stylesheet available to children components

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?

Upvotes: 0

Views: 33

Answers (1)

benshabatnoam
benshabatnoam

Reputation: 7632

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
  ...
})

Upvotes: 1

Related Questions