Last active
November 19, 2020 18:22
-
-
Save azamanaza/a5ae7154a6c040b50c6899d7712bcd28 to your computer and use it in GitHub Desktop.
Angular ::ng-deep is set for deprecation. Below is a workaround or a solution until encapsulation is final.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Component({ | |
selector: 'app-encapsulate', | |
templateUrl: './encapsulate.component.html', | |
styleUrls: ['./encapsulate.component.scss'], | |
encapsulation: ViewEncapsulation.None | |
}) | |
export class EncapsulateComponent implements OnInit { | |
constructor(el: ElementRef) { | |
const { nativeElement } = el; | |
nativeElement.className = nativeElement.tagName.toLowerCase(); | |
// now in your scss, you can wrap everting in .app-encapsulate or whatever your compoenent's selector is. | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Src/watched issue: angular/angular#25160