I have been trying to build a responsive nav-bar and do not wish to use a media query, so I intend to use *ngIF with the window size as a criterion. But I have
*ngIF
To get it on init
public innerWidth: any; ngOnInit() { this.innerWidth = window.innerWidth; }
If you wanna keep it updated on resize:
@HostListener('window:resize', ['$event']) onResize(event) { this.innerWidth = window.innerWidth; }