Skip to content

Instantly share code, notes, and snippets.

@twobiers
Created November 13, 2020 05:58
Show Gist options
  • Save twobiers/c0c50e714523b1542c487ead3d57bb45 to your computer and use it in GitHub Desktop.
Save twobiers/c0c50e714523b1542c487ead3d57bb45 to your computer and use it in GitHub Desktop.
CloseScrollStrategy on MatAutocomplete
import { NgModule } from '@angular/core';
import { MAT_AUTOCOMPLETE_SCROLL_STRATEGY } from '@angular/material';
import { Overlay, ScrollStrategy } from '@angular/cdk/overlay';
@NgModule({
declarations: [
[..]
],
providers: [{ provide: MAT_AUTOCOMPLETE_SCROLL_STRATEGY, useFactory: function (overlay: Overlay): () => ScrollStrategy {
return () => overlay.scrollStrategies.close();
}, deps: [Overlay]}]
})
export class AppModule {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment