I have div element which I want to show or no depending on the screen size (I know that can be done by mediaqueries, but tried to approach this with Angular). So I got working NgStyle condition
[ngStyle]="{display: innerWidth < '600' ? 'none' : 'flex'}"
when innerWidth is variable in the .ts file of this component
public innerWidth: any;
ngOnInit() {
this.innerWidth = window.innerWidth;
}
This is working fine, but changing only when I reload the page, so I want to trigger this change dynamically when I resize the browser window, is that possible in similar way?
this.innerWidthwhen that event occurs. Checkout here stackoverflow.com/a/45451974/3965832