How to write window resize event in Angular?
Answers (1)
Add AnswerIn app.component.html file:
<div (window:resize)="onResize($event)"
app.component.ts file
height:number; width:number; onResize(event) { this.width = Math.round(event.target.innerWidth); this.height = Math.round(event.target.innerWidth); }
Now, you can get width & height of window when you resize it.