Quantcast
Channel: Angular window resize event - Stack Overflow
Viewing all articles
Browse latest Browse all 20

Answer by Mohamed Aljamil for Angular window resize event

$
0
0

I checked most of these answers. then decided to check out Angular documentation on Layout.

Angular has its own Observer for detecting different sizes and it is easy to implement into the component or a Service.

a simpl example would be:

import {BreakpointObserver, Breakpoints} from '@angular/cdk/layout';@Component({...})class MyComponent {  constructor(breakpointObserver: BreakpointObserver) {    breakpointObserver.observe([      Breakpoints.HandsetLandscape,      Breakpoints.HandsetPortrait    ]).subscribe(result => {      if (result.matches) {        this.activateHandsetLayout();      }    });  }}

hope it helps


Viewing all articles
Browse latest Browse all 20

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>