An Angular 5+ powered AOT compatible device detector that helps to identify browser, os and other useful information regarding the device using the app. The processing is based on user-agent.
To install this library, run:
$ npm install ngx-device-detector --save
In your component where you want to use the Device Service
Holds the following properties
- isMobile() : returns if the device is a mobile device (android / iPhone/ windows-phone etc)
- isTablet() : returns if the device us a tablet (iPad etc)
- isDesktop() : returns if the app is running on a Desktop browser.
To generate all
$ npm run tsc
To lint all
$ npm run lint
To run unit tests
$ npm run test
To build the library
$ npm run build
Run the DEMO
Make sure you have @angular/cli installed
$ npm install -g @angular/cli
$ cd demo$ npm install$ ng serve
the demo will be up at
Please see CHANGE_LOG.MD for the updates.
IE10, IE11 Compatibility
If you're consuming the library for IE10 & IE11, make sure to uncomment (at least) these lines from
src/polyfills.ts in your project.
The library is inspired by and based on the work from ng-device-detector . Also used a typescript wrapper of the amazing work in ReTree for regex based needs and an Angular2 Library Creator boilerplate to get the work started fast. I.e. Generator Angular2 library.
MIT © Ahsan Ayaz