Check out example codes for "typescript ge t current screen resolution". It will help you in understanding the concepts better.

Code Example 1

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

  selector: "app-login",
  templateUrl: './login.component.html',
  styleUrls: ['./login.component.css']

export class LoginComponent implements OnInit, OnDestroy {
    // Declare height and width variables

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

    // Constructor
    constructor() {


Learn ReactJs, React Native from