npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

angular-device-information

v4.0.0

Published

<head> <meta name="google-site-verification" content="zApSXb8oh9SIBjqaVNlIs_IPT7sTwY4vwk59YS_CshE" /></head> <h1 align="center">angular device information</h1>

Downloads

9,901

Readme

Dependencies

| Angular | Version | | ------------- | ------------- | | Angular 8+ | v 1.1.5 | | Angular 14.x | v 2.0.1 | | Angular 15.x | v 3.0.6 | | Angular 16.x | v 4.0.0 |

Support us :

Installation

To install this library, run:

$ npm install angular-device-information --save

NPM LINK : https://www.npmjs.com/package/angular-device-information

In your app.module.ts file add AngularDeviceInformationService as providers(Optional)

  import { NgModule } from '@angular/core';
  import { BrowserModule } from '@angular/platform-browser';
  import { FormsModule } from '@angular/forms';
  
  import { AppComponent } from './app.component';
  import { AngularDeviceInformationService } from 'angular-device-information';
  
  @NgModule({
    imports:      [ BrowserModule, FormsModule ],
    providers:[AngularDeviceInformationService],
    declarations: [ AppComponent ],
    bootstrap:    [ AppComponent ]
  })
  

In your component where you want to use the Device Service

 import { Component } from '@angular/core';
 ...
 import { AngularDeviceInformationService } from 'angular-device-information';
 ...
 @Component({
   selector: 'home',  // <home></home>
   styleUrls: [ './home.component.scss' ],
   templateUrl: './home.component.html',
   ...
 })

 export class HomeComponent {
 
   constructor(private deviceInformationService: AngularDeviceInformationService) {
 
      console.log(deviceInformationService.isMobile());  // returns if the device is a mobile device (android / iPhone / windows-phone etc)
      console.log(deviceInformationService.isTablet());  // returns if the device is a tablet (tablet iPad etc)
      console.log(deviceInformationService.isDesktop()); // returns if the app is running on a Desktop browser.
      console.log(deviceInformationService.getDeviceType()); // returns if the app is running on a Desktop browser.
      console.log(deviceInformationService.getDeviceInfo().os);  // returns os name like Windows/Andtoid/iOS/Linux/Mac OS X etc
      console.log(deviceInformationService.getDeviceInfo().osVersion);  // returns os version like 10/8.1/7 ...etc
      console.log(deviceInformationService.getDeviceInfo().browser);  // returns browser name like chrome/firefox ...etc
      console.log(deviceInformationService.getDeviceInfo().browserVersion);  // returns browser version as number
      console.log(deviceInformationService.getDeviceInfo().browserMajorVersion);  // returns full browser version as number
      console.log(deviceInformationService.getDeviceInfo().screen_resolution);  // returns screnn size like 1390x860/640x800 ...etc
      console.log(deviceInformationService.getDeviceInfo().cookies);  // returns cookies enabled or no 
      console.log(deviceInformationService.getDeviceInfo().userAgent);  // returns userAgent
   }
   
 }

License

MIT