Search
 
SCRIPT & CODE EXAMPLE
 

TYPESCRIPT

mat-autocomplete options dropdown does not stick when scrolling

//in HTML
<input
  #autoCompleteInput //it is the selector used in component
  type="text"
  class="form-control"
  matInput
  [matAutocomplete]="auto"
  formControlName="country"
  (input)="filterCountries($event.target.value)"
/>

//in component
@ViewChild('autoCompleteInput', { read: MatAutocompleteTrigger, static: false })
autoComplete: MatAutocompleteTrigger;

ngOnInit(): void {
    window.addEventListener('scroll', this.scrollEvent, true);
}

scrollEvent = (event: any): void => {
    if(this.autoComplete.panelOpen)
      // this.autoComplete.closePanel(); //you can also close the panel 
      this.autoComplete.updatePosition();
};
Comment

PREVIOUS NEXT
Code Example
Typescript :: ic markets minimum deposit 
Typescript :: how to invert sortField primeng 
Typescript :: captain tsubasa episodi 
Typescript :: return type depends on input typescript 
Typescript :: error NG6002: Appears in the NgModule.imports of DashboardModule, but could not be resolved to an NgModule class. 
Typescript :: typescript type casting 
Typescript :: first k digits of n*n 
Typescript :: Vulnerability of systems is divided into two (2) categories. List the two (2) categories. 
Typescript :: print gets opened whenever pdf is opened 
Typescript :: sap abap check file exists on application server tcode 
Typescript :: typescript reset class properties to default 
Typescript :: typescript object annotation 
Typescript :: localstorage getitem angular 
Typescript :: add and edit in ionic page 
Typescript :: why are my fonts and logo not appearing before I sign in asp.net 
Typescript :: based on previous make validation for required in reactive forms 
Typescript :: how to print certain elements of an array 
Typescript :: filtering objects in django templates 
Typescript :: jquery tscroll up 
Typescript :: vb net code snippets for storing password 
Cpp :: fast i/o c++ 
Cpp :: if vector contains value c++ 
Cpp :: c++ message box error 
Cpp :: vhdl integer to std_logic_vector 
Cpp :: cpp sample code 
Cpp :: c++ fill array with 0 
Cpp :: infinity c++ 
Cpp :: c++ how to generate a random number in a range 
Cpp :: C++ sqlite open file in other directory 
Cpp :: ostream was not declared in this scope 
ADD CONTENT
Topic
Content
Source link
Name
5+6 =