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

Answer by Anh Hoang for Angular window resize event

$
0
0

On Angular2 (2.1.0) I use ngZone to capture the screen change event.

Take a look on the example:

import { Component, NgZone } from '@angular/core';//import ngZone library...//capture screen changed inside constructorconstructor(private ngZone: NgZone) {    window.onresize = (e) =>    {        ngZone.run(() => {            console.log(window.innerWidth);            console.log(window.innerHeight);        });    };}

I hope this help!


Viewing all articles
Browse latest Browse all 20

Trending Articles



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