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();
    }


}

Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
typescript ge t current screen resolution typescript get screen sizer get size height angular get screen size typescript how to get width in angular view part typescript check screen size get screen width angular2 angular 2 window height width get screen height in angular 7 angular 7 get screen size how to get browser size in real time in typescript typescript get window width how to get window width in typescript typescript calculate height of screen angular 2 get device size innerWidth typescript angular component get windows width typescript if width screen angular typescript get screen width angular component check screen width get screen width angular 7 how to know width of component in angualr from typescript how to use viewport height in angular typescript set width based viewport get window width in angular universal angular viewport size how do you access the window size in typescript screen width typescript window.screen.width typescript screen width and height typescript get window width px angular 8 get viewport size angular on load get window size on load angular 2 how to get the size of the screen in typescript window.screen.width in angular 8 get viewport width css angular get viewport size angular get viewport width angular 2 angular 5 get window heightr angular how to get viewport width angular get current view height typescript window width heighth get screen width typescript angular get device width get max pixel screen angular get height of view angular angular get screen width in component calculate screen heigh typescript typescript get screen size angular get viewport height how can i find browser size in angular 2+
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source