Is using ::ng-deep
in angular component scss right way of applying styling to third party components like datepicker, multiselect?
The ::ng-deep pseudo-class selector So this style will be applied to all h2 elements inside app-root , but not outside of it as expected. This combination of selectors is useful for example for applying styles to elements that were passed to the template using ng-content , have a look at this post for more details.
css file. The ::deep pseudo-element selects elements that are descendants of an element's generated scope identifier. The following example shows a parent component called Parent with a child component called Child .
The documentation at https://angular.io/guide/component-styles states this about :ng-deep : The shadow-piercing descendant combinator is deprecated and support is being removed from major browsers and tools.
Just don't use NG-Deep; it kind-of sort-of works but all the red flags are out on it and forget going too deep. Just use root level specific SCSS selectors as shown here! Here's another example of avoiding :ng-deep!
It's recommended to avoid using ng-deep
as it is marked deprecated.
See here in the angular documentation
There has been raised a question what's the alternative here on stackoverflow
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With