Answers for "angular get device information"

0

angular get device information

npm install ngx-device-detector
Posted by: Guest on March-10-2021
0

angular get device information

import { Component, VERSION } from "@angular/core";
import { DeviceDetectorService } from "ngx-device-detector";

@Component({
  selector: "my-app",
  templateUrl: "./app.component.html",
  styleUrls: ["./app.component.css"]
})
export class AppComponent {
  name = "Angular " + VERSION.major;
  deviceInfo = null;
  isDesktopDevice: boolean;
  isTablet: boolean;
  isMobile: boolean;

  constructor(private deviceService: DeviceDetectorService) {
    this.epicFunction();
  }

  epicFunction() {
    this.deviceInfo = this.deviceService.getDeviceInfo();
    this.isMobile = this.deviceService.isMobile();
    this.isTablet = this.deviceService.isTablet();
    this.isDesktopDevice = this.deviceService.isDesktop();
  }
}
Posted by: Guest on March-10-2021

Code answers related to "angular get device information"

Code answers related to "Javascript"

Browse Popular Code Answers by Language