how to run resize event only on client side angular
@HostListener('window:resize', ['$event'])
onResize(event) {
event.target.innerWidth;
}
resizeObservable$: Observable<Event>
resizeSubscription$: Subscription
ngOnInit() {
this.resizeObservable$ = fromEvent(window, 'resize')
this.resizeSubscription$ = this.resizeObservable$.subscribe( evt => {
console.log('event: ', evt)
})
}@HostListener('window:resize', ['$event'])
onResize(event) {
if(window){
let a=window.innerWidth;
}
}
<div (window:resize)="onResize($event)"
Also in JavaScript:
- how to delete object property of array javascript
- react if statement
- javascript operator double not
- Consider using '--resolveJsonModule
- how to add multiple comment in react
- multiple image upload with preview and delete react js
- how to eat beans in javascirpt
- nsenter
- jquery add div element
- javascript check if empty
- The target origin provided ('https://www.youtube.com') does not match the recipient window's origin ('http://localhost')
- promise catch
- get value in tag with id JS
- how to import jquery in js file
- template literal syntax' is only available in ES6 (use 'esversion: 6'). (W119)jshint(W119)
- cJSON_CreateObject
- react fun tion
- Truthy and Falsy js
- push array javascript
- javascript array remove element
- ignore node_modules
- jqgrid aftershowform
- javascript jqgrid events afterShowForm
- summernote mentions ajax