Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ngx-device-detector

Package Overview
Dependencies
Maintainers
0
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ngx-device-detector

  • 9.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
162K
increased by3.79%
Maintainers
0
Weekly downloads
 
Created

What is ngx-device-detector?

The ngx-device-detector package is an Angular library that provides tools to detect the device, OS, and browser information of the client. It helps in customizing the user experience based on the device type, operating system, and browser being used.

What are ngx-device-detector's main functionalities?

Detect Device Type

This feature allows you to detect the type of device (mobile, tablet, or desktop) the user is using. The code sample demonstrates how to use the DeviceDetectorService to determine the device type and display it in a component.

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

@Component({
  selector: 'app-device-info',
  template: '<p>Device Type: {{ deviceType }}</p>'
})
export class DeviceInfoComponent implements OnInit {
  deviceType: string;

  constructor(private deviceService: DeviceDetectorService) {}

  ngOnInit() {
    this.deviceType = this.deviceService.isMobile() ? 'Mobile' : this.deviceService.isTablet() ? 'Tablet' : 'Desktop';
  }
}

Detect Operating System

This feature allows you to detect the operating system of the user's device. The code sample shows how to use the DeviceDetectorService to get the OS information and display it in a component.

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

@Component({
  selector: 'app-os-info',
  template: '<p>Operating System: {{ os }}</p>'
})
export class OsInfoComponent implements OnInit {
  os: string;

  constructor(private deviceService: DeviceDetectorService) {}

  ngOnInit() {
    this.os = this.deviceService.os;
  }
}

Detect Browser

This feature allows you to detect the browser being used by the client. The code sample demonstrates how to use the DeviceDetectorService to get the browser information and display it in a component.

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

@Component({
  selector: 'app-browser-info',
  template: '<p>Browser: {{ browser }}</p>'
})
export class BrowserInfoComponent implements OnInit {
  browser: string;

  constructor(private deviceService: DeviceDetectorService) {}

  ngOnInit() {
    this.browser = this.deviceService.browser;
  }
}

Other packages similar to ngx-device-detector

Keywords

FAQs

Package last updated on 08 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc