Skip to content

Instantly share code, notes, and snippets.

@diegohordi
Created March 10, 2021 18:23
Show Gist options
  • Save diegohordi/db94675963acae1fef9ef7a392637f98 to your computer and use it in GitHub Desktop.
Save diegohordi/db94675963acae1fef9ef7a392637f98 to your computer and use it in GitHub Desktop.
Detect screen size Angular
import {BreakpointObserver} from '@angular/cdk/layout';
...
breakpointObserver.observe(['(max-width: 1024px)']).subscribe(result => {
if (result.matches) {
this.responsiveVersion = true;
} else {
this.responsiveVersion = false;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment