Opening a mat-autocomplete in Angular Material doesn't prevent background content from scrolling. I have tried using block strategy and it doesn't work.
Add focus and focusout on your input field and implement methods for that.
(focus)="focusinmethod()"
(focusout)="focusoutmethod()"
focusinmethod(){
let b = document.body;
b.style.overflow = "hidden";
}
focusoutmethod(){
let b = document.body;
b.style.overflow = "auto";
}
here I'm providing stackbliz example too. demo
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments