Within my Angular application
I have implemented the following code to customize the body style:
constructor(private elementRef: ElementRef) { }
ngOnInit() {
this.elementRef.nativeElement.ownerDocument.body.style.overflowY = 'hidden';
}
For a specific scenario, I need to add "important" to it
This modification would look like this:
this.elementRef.nativeElement.ownerDocument.body.style.overflowY = 'hidden !important';
However, this approach is not effective, as "important" is not being applied to the style.
Note that since I need to apply this directly to the body element and not to a specific HTML element within my component, ngStyle cannot accomplish this task.
Any suggestions?