Search
 
SCRIPT & CODE EXAMPLE
 

TYPESCRIPT

typescript ge t current screen resolution

import { Component, OnInit, OnDestroy, Input } from "@angular/core";
// Import this, and write at the top of your .ts file
import { HostListener } from "@angular/core";

@Component({
  selector: "app-login",
  templateUrl: './login.component.html',
  styleUrls: ['./login.component.css']
})

export class LoginComponent implements OnInit, OnDestroy {
    // Declare height and width variables
    scrHeight:any;
    scrWidth:any;

    @HostListener('window:resize', ['$event'])
    getScreenSize(event?) {
          this.scrHeight = window.innerHeight;
          this.scrWidth = window.innerWidth;
          console.log(this.scrHeight, this.scrWidth);
    }

    // Constructor
    constructor() {
        this.getScreenSize();
    }


}
Comment

PREVIOUS NEXT
Code Example
Typescript :: close mat dialog from component 
Typescript :: styled components if else 
Typescript :: aggregate in r 
Typescript :: python select only first elements of a 2d array 
Typescript :: python get first n elements of list 
Typescript :: how to push an object into an array typescript 
Typescript :: html download tag not working angular 
Typescript :: create file object from url typescript 
Typescript :: matlab not draw two plots in one figure 
Typescript :: how to remove one object in an array of objects in mongoose 
Typescript :: typescript object key enum 
Typescript :: extends vs implements java 
Typescript :: typescript usestate array type 
Typescript :: print elements of unordered set c++ 
Typescript :: ts declare function type 
Typescript :: extend type typescript 
Typescript :: add dots to line matplotlib 
Typescript :: what will the type of empty object in typescript 
Typescript :: typescript check type of variable 
Typescript :: angular typescript filter array group by attribute 
Typescript :: nested slots in vue 
Typescript :: jquery select multiple elements with same class 
Typescript :: typescript decorators 
Typescript :: get a list of all email accounts in cpanel 
Typescript :: typescript returntype remove promise 
Typescript :: counts of unique values in rows of given 2D array numpy 
Typescript :: get object key value typescript 
Typescript :: angular rxjs 
Typescript :: typescript open site in frame 
Typescript :: from how many ways we can define props with typescript react 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =