::ng-deep leaks out of component
See original GitHub issueš bug report
Affected Package
The issue is caused by package @angular/core
Is this a regression?
Not sure
Description
Using ::ng-deep` causes the styles to be applied to elements completely outside of the componentās template. According to the documentation it should only affect elements inside the childās template and descendant componentās templates.
š¬ Minimal Reproduction
https://stackblitz.com/edit/angular-oo7twb?file=src%2Fapp%2Fhello.component.ts
š„ Exception or Error
Notice that all 3 <p>
elements are styled with the ::after
text. The first one should not get the style.
š Your Environment
Angular 7.2.13
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:8 (3 by maintainers)
Top Results From Across the Web
ng-deep changes other components style - css - Stack Overflow
I am using a .md file to display information in a dialog from Material for Angular. The thing is thatĀ ...
Read more >Angular 10 - Avoid using ::ng-deep (ngdeep)
I found issues when attempting to override stylings mostly for Material Components but, have had my own (parent) components present challengesĀ ...
Read more >The Dangers Of NG-Deep Bleeding - Upmostly
But hold on, we've heard about this amazing thing called ng-deep that basically removes encapsulation for components in Angular! Let's try it!
Read more >Angular :host, :host-context, ::ng-deep - The Complete Guide
As we develop a component style suite for an application, we tend to run into situations where the styles from one feature start...
Read more >There is no alternative to ::ng-deep - Tom Smykowski - Medium
In Angular, like in any other framework, sometimes you have to style a child component based from a parent component.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Looks like you can use :host ::ng-deep instead of ::ng-deep and it works. I had the same problem and this method solved the problem.
@CAspeling you can using following solution
Output: