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;
}
More Related Contents:
- I want to create a color picker in ionic app [closed]
- What to use in place of ::ng-deep
- How do I make an HTML button not reload the page
- How to declare a variable in a template in Angular
- Angular 2 Dropdown Options Default Value
- Show loading screen when navigating between routes in Angular 2
- Angular2 – Input Field To Accept Only Numbers
- Angular 2 Checkbox Two Way Data Binding
- Detect click outside Angular component
- Angular 2 Remove Hash (#) from the URL
- How can I repeat a piece of HTML multiple times without ngFor and without another @Component?
- How to load image (and other assets) in Angular an project?
- Dynamically ADDING and REMOVING Components in Angular
- Spring Boot with AngularJS html5Mode
- Angular2, what is the correct way to disable an anchor element?
- How to convert input value to uppercase in angular 2 (value passing to ngControl)
- Access Control Allow Origin issue in Angular 2
- How to remove the previously selected option from a drop-down menu in a table?
- How to show split header in the material table having nested group of data in angular
- How to render string with html tags in Angular 4+? [duplicate]
- Remove host component tag from html in angular 4
- Angular4 – Scrolling to anchor
- Fire onmouseover event when element is disabled
- How to translate HTML string to real HTML element by ng-for in Angular 2?
- Angular2 without hash in the url
- Angular2 disable button
- Server-Sent Events vs Polling
- Using HTML anchor link fragment in Angular 6
- Create tree view with horizontal and vertical lines showing the connectivity using css
- How to serve up images in Angular2?