1@HostListener('window:resize', ['$event'])
2onResize(event) {
3 event.target.innerWidth;
4}
5
1resizeObservable$: Observable<Event>
2resizeSubscription$: Subscription
3
4ngOnInit() {
5 this.resizeObservable$ = fromEvent(window, 'resize')
6 this.resizeSubscription$ = this.resizeObservable$.subscribe( evt => {
7 console.log('event: ', evt)
8 })
9}
1@HostListener('window:resize', ['$event'])
2onResize(event) {
3 if(window){
4 let a=window.innerWidth;
5 }
6}
7