├── .editorconfig ├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── add-missing-device.md │ ├── bug_report.md │ └── feature_request.md └── workflows │ ├── main.yml │ └── pull_request.yml ├── .gitignore ├── .npmignore ├── .prettierrc ├── .travis.yml ├── CHANGE_LOG.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── angular.json ├── assets ├── iomechs-logo-dark.svg ├── iomechs-logo.svg └── logo.svg ├── commitlint.config.js ├── docs ├── classes │ ├── AppPage.html │ └── ReTree.html ├── components │ └── AppComponent.html ├── contributing.html ├── coverage.html ├── dependencies.html ├── fonts │ ├── FontAwesome.otf │ ├── fontawesome-webfont.eot │ ├── fontawesome-webfont.svg │ ├── fontawesome-webfont.ttf │ ├── fontawesome-webfont.woff │ ├── fontawesome-webfont.woff2 │ ├── ionicons.eot │ ├── ionicons.svg │ ├── ionicons.ttf │ ├── ionicons.woff │ ├── ionicons.woff2 │ ├── roboto-v15-latin-300.eot │ ├── roboto-v15-latin-300.svg │ ├── roboto-v15-latin-300.ttf │ ├── roboto-v15-latin-300.woff │ ├── roboto-v15-latin-300.woff2 │ ├── roboto-v15-latin-700.eot │ ├── roboto-v15-latin-700.svg │ ├── roboto-v15-latin-700.ttf │ ├── roboto-v15-latin-700.woff │ ├── roboto-v15-latin-700.woff2 │ ├── roboto-v15-latin-italic.eot │ ├── roboto-v15-latin-italic.svg │ ├── roboto-v15-latin-italic.ttf │ ├── roboto-v15-latin-italic.woff │ ├── roboto-v15-latin-italic.woff2 │ ├── roboto-v15-latin-regular.eot │ ├── roboto-v15-latin-regular.svg │ ├── roboto-v15-latin-regular.ttf │ ├── roboto-v15-latin-regular.woff │ └── roboto-v15-latin-regular.woff2 ├── graph │ └── dependencies.svg ├── images │ ├── compodoc-vectorise-inverted.png │ ├── compodoc-vectorise-inverted.svg │ ├── compodoc-vectorise.png │ ├── compodoc-vectorise.svg │ ├── coverage-badge-documentation.svg │ ├── coverage-badge.svg │ └── favicon.ico ├── index.html ├── injectables │ ├── DeviceDetectorService.html │ └── UniversalDeviceDetectorService.html ├── interfaces │ └── DeviceInfo.html ├── js │ ├── compodoc.js │ ├── lazy-load-graphs.js │ ├── libs │ │ ├── EventDispatcher.js │ │ ├── bootstrap-native.js │ │ ├── clipboard.min.js │ │ ├── custom-elements-es5-adapter.js │ │ ├── custom-elements.min.js │ │ ├── d3.v3.min.js │ │ ├── deep-iterator.js │ │ ├── es6-shim.min.js │ │ ├── htmlparser.js │ │ ├── innersvg.js │ │ ├── lit-html.js │ │ ├── prism.js │ │ ├── promise.min.js │ │ ├── svg-pan-zoom.min.js │ │ ├── tablesort.min.js │ │ ├── tablesort.number.min.js │ │ ├── vis.min.js │ │ └── zepto.min.js │ ├── menu-wc.js │ ├── menu-wc_es5.js │ ├── menu.js │ ├── routes.js │ ├── search │ │ ├── lunr.min.js │ │ ├── search-lunr.js │ │ ├── search.js │ │ └── search_index.js │ ├── sourceCode.js │ ├── svg-pan-zoom.controls.js │ ├── tabs.js │ └── tree.js ├── license.html ├── miscellaneous │ ├── enumerations.html │ ├── functions.html │ └── variables.html ├── modules.html ├── modules │ ├── AppModule.html │ ├── AppModule │ │ └── dependencies.svg │ ├── AppServerModule.html │ ├── AppServerModule │ │ └── dependencies.svg │ └── DeviceDetectorModule.html ├── overview.html ├── pipes │ └── KeysPipe.html ├── properties.html └── styles │ ├── bootstrap-card.css │ ├── bootstrap.min.css │ ├── compodoc.css │ ├── dark.css │ ├── font-awesome.min.css │ ├── ionicons.min.css │ ├── laravel.css │ ├── material.css │ ├── original.css │ ├── postmark.css │ ├── prism.css │ ├── readthedocs.css │ ├── reset.css │ ├── stripe.css │ ├── style.css │ ├── tablesort.css │ └── vagrant.css ├── jestSetup.ts ├── package-lock.json ├── package.json ├── projects ├── demo │ ├── e2e │ │ ├── protractor.conf.js │ │ ├── src │ │ │ ├── app.e2e-spec.ts │ │ │ └── app.po.ts │ │ └── tsconfig.json │ ├── server.ts │ ├── server │ │ ├── Procfile │ │ └── package.json │ ├── src │ │ ├── app │ │ │ ├── app.component.html │ │ │ ├── app.component.scss │ │ │ ├── app.component.spec.ts │ │ │ ├── app.component.ts │ │ │ ├── app.config.server.ts │ │ │ ├── app.config.ts │ │ │ └── pipes │ │ │ │ ├── keys.pipe.spec.ts │ │ │ │ └── keys.pipe.ts │ │ ├── assets │ │ │ ├── .gitkeep │ │ │ └── images │ │ │ │ └── github-logo.png │ │ ├── express.tokens.ts │ │ ├── favicon.ico │ │ ├── index.html │ │ ├── main.server.ts │ │ ├── main.ts │ │ ├── polyfills.ts │ │ ├── server.ts │ │ └── styles.scss │ ├── tsconfig.app.json │ └── tslint.json └── ngx-device-detector │ ├── README.md │ ├── ng-package.json │ ├── package.json │ ├── src │ ├── lib │ │ ├── device-detector.constants.ts │ │ ├── device-detector.service.spec.ts │ │ ├── device-detector.service.ts │ │ └── retree.ts │ └── public-api.ts │ ├── tsconfig.lib.json │ ├── tsconfig.lib.prod.json │ └── tslint.json ├── scripts ├── bump-version.js └── deploy_ssr_demo.sh ├── steps-to-release.md ├── tsconfig.json ├── tsconfig.spec.json └── tslint.json /.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see https://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.ts] 12 | quote_type = single 13 | 14 | [*.md] 15 | max_line_length = off 16 | trim_trailing_whitespace = false 17 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: ahsanayaz 4 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/add-missing-device.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Add Missing Device 3 | about: Request to add a missing device not being detected by the library 4 | title: "[MISSING DEVICE]" 5 | labels: add device to regexes 6 | assignees: '' 7 | 8 | --- 9 | 10 | ## Device User Agent 11 | 12 | 13 | ## Expected Output 14 | 15 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | - OS: [e.g. iOS] 28 | - Browser [e.g. chrome, safari] 29 | - Version [e.g. 22] 30 | 31 | **Smartphone (please complete the following information):** 32 | - Device: [e.g. iPhone6] 33 | - OS: [e.g. iOS8.1] 34 | - Browser [e.g. stock browser, safari] 35 | - Version [e.g. 22] 36 | 37 | **Additional context** 38 | Add any other context about the problem here. 39 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: Build 2 | on: 3 | push: 4 | branches: 5 | - master 6 | 7 | jobs: 8 | build: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/checkout@v2.3.4 12 | - name: Use Node.js 13 | uses: actions/setup-node@v2 14 | with: 15 | node-version: '22' 16 | - name: Install dependencies 17 | run: npm install --legacy-peer-deps 18 | - name: Lint and Test 19 | run: npm run test && npm run lint 20 | - name: Build 21 | run: npm run build:lib && npm run build:ci && cp -R dist/demo/browser ./docs/demo 22 | - name: GitHub Pages action 23 | uses: peaceiris/actions-gh-pages@v3.9.3 24 | with: 25 | github_token: ${{ secrets.GITHUB_TOKEN }} 26 | publish_dir: ./docs 27 | -------------------------------------------------------------------------------- /.github/workflows/pull_request.yml: -------------------------------------------------------------------------------- 1 | name: Lint and Build 2 | on: 3 | pull_request: 4 | branches: 5 | - master 6 | 7 | jobs: 8 | build: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/checkout@v2.3.4 12 | - name: Use Node.js 13 | uses: actions/setup-node@v2 14 | with: 15 | node-version: '22' 16 | - name: Install dependencies 17 | run: npm install --legacy-peer-deps 18 | - name: Lint and Test 19 | run: npm run test && npm run lint 20 | - name: Build 21 | run: npm run build:lib && npm run build:ci 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # editors 4 | .vscode 5 | 6 | # compiled output 7 | /dist 8 | /tmp 9 | /out-tsc 10 | # Only exists if Bazel was run 11 | /bazel-out 12 | 13 | # dependencies 14 | /node_modules 15 | 16 | # profiling files 17 | chrome-profiler-events*.json 18 | speed-measure-plugin*.json 19 | 20 | # IDEs and editors 21 | /.idea 22 | .project 23 | .classpath 24 | .c9/ 25 | *.launch 26 | .settings/ 27 | *.sublime-workspace 28 | 29 | # IDE - VSCode 30 | .vscode/* 31 | !.vscode/settings.json 32 | !.vscode/tasks.json 33 | !.vscode/launch.json 34 | !.vscode/extensions.json 35 | .history/* 36 | 37 | # misc 38 | /.angular/cache 39 | /.sass-cache 40 | /connect.lock 41 | /coverage 42 | /libpeerconnection.log 43 | npm-debug.log 44 | yarn-error.log 45 | testem.log 46 | /typings 47 | 48 | # System Files 49 | .DS_Store 50 | Thumbs.db 51 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | # Node 2 | node_modules/* 3 | npm-debug.log 4 | docs/* 5 | # DO NOT IGNORE TYPESCRIPT FILES FOR NPM 6 | # TypeScript 7 | # *.js 8 | # *.map 9 | # *.d.ts 10 | 11 | # JetBrains 12 | .idea 13 | .project 14 | .settings 15 | .idea/* 16 | *.iml 17 | 18 | # VS Code 19 | .vscode/* 20 | 21 | # Windows 22 | Thumbs.db 23 | Desktop.ini 24 | 25 | # Mac 26 | .DS_Store 27 | **/.DS_Store 28 | 29 | # Ngc generated files 30 | **/*.ngfactory.ts 31 | 32 | # Library files 33 | src/* 34 | build/* 35 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 120, 3 | "singleQuote": true, 4 | "semi": true, 5 | "bracketSpacing": true, 6 | "arrowParens": "avoid" 7 | } 8 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | sudo: true 3 | node_js: 4 | - 16 5 | 6 | demo/dist: xenial 7 | 8 | branches: 9 | only: 10 | - master 11 | 12 | services: 13 | - xvfb 14 | 15 | script: 16 | - npm run lint 17 | - npm install 18 | - npm run test 19 | - node_modules/.bin/webdriver-manager update 20 | - npm run build:ci 21 | - cp -R dist/demo/browser ./docs/demo 22 | 23 | deploy: 24 | provider: pages 25 | skip_cleanup: true 26 | github_token: $GITHUB_TOKEN # Set in travis-ci.org dashboard 27 | local_dir: docs 28 | on: 29 | branch: master 30 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ## How to Contribute 2 | 3 | There are many ways you can Contribute to this project! 4 | - Create issues or help close them 5 | - Fork, Enhance, Fix Bugs, and send in Pull Requests 6 | - Help write Tests or improve Examples / Documentation 7 | - Share repo with others. 8 | 9 | ### Issues 10 | Found a bug, have some feedback or really want some feature? Lock in an Issue. Here are some tips: 11 | 12 | - Make sure the bug you're reporting really is a bug and you have read the docs/readme. 13 | - Provide as many details as you can about the bug. How can it be reproduced? What have you tried so far? 14 | - For feature requests, really explain why your feature is important and how it improves the library and helps the developers using it. 15 | - Go through existing issues. Make sure that it hasn't already been opened. 16 | - If planning on helping close an issue, don't be shy. Ask questions and get more information before sending your PR. 17 | ### Pull Requests 18 | 19 | Want to fix a bug, implement a feature or help with the tests / docs? Please read this first: 20 | 21 | - Make sure there's an open issue for what you're sending in your Pull Request. If not, open it. 22 | - Send in your PRs agains the `master` branch. 23 | - Write unit tests / docs for any new feature you implement. 24 | - Make sure your PRs pass all tests and CI. 25 | - Be active in your relevant issue and PR threads. 26 | - Make sure no one else is assigned or working on the issue. It's a good idea to leave a comment stating that you're going to implement it before sending in your PR. 27 | - This way no two devs are working on the same thing. 28 | - If required, update the CHANGELOG.md file with a small summary of your changes in the latest version (add a new section if needed) 29 | 30 | 31 | ### Finally, Thank you! 32 | 33 | It means a lot that you took time out to improve this package and contribute back to the community. 🎉 34 | 35 | ### Relevant Links 36 | 37 | [Project Page](https://github.com/AhsanAyaz/ngx-device-detector) 38 | 39 | [Author](https://github.com/AhsanAyaz) 40 | 41 | [NPM Package](https://www.npmjs.com/package/ngx-device-detector) 42 | 43 | [License](https://github.com/AhsanAyaz/ngx-device-detector/blob/master/LICENSE) 44 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Muhammad Ahsan Ayaz 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 |
3 |
10 | An Angular 6+ 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. This library was built at KoderLabs, which is one of the best places I've worked at ❤️ 11 |
12 | 13 | 20 |
21 | Deprecated package :
22 |
23 |
24 |
26 | New package :
27 |
28 |
29 | If you use Angular 5, you must use v1.5.2 or earlier
30 |
There are many ways you can Contribute to this project!
88 |Found a bug, have some feedback or really want some feature? Lock in an Issue. Here are some tips:
96 |Want to fix a bug, implement a feature or help with the tests / docs? Please read this first:
105 |master branch.It means a lot that you took time out to improve this package and contribute back to the community. 🎉
117 |MIT License
87 |Copyright (c) 2021 Muhammad Ahsan Ayaz
88 |Permission is hereby granted, free of charge, to any person obtaining a copy 89 | of this software and associated documentation files (the "Software"), to deal 90 | in the Software without restriction, including without limitation the rights 91 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 92 | copies of the Software, and to permit persons to whom the Software is 93 | furnished to do so, subject to the following conditions:
94 |The above copyright notice and this permission notice shall be included in all 95 | copies or substantial portions of the Software.
96 |THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 97 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 98 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 99 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 100 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 101 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 102 | SOFTWARE.
103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 |55 |
58 | src/index.ts
59 |
| 78 | 79 | 80 | 81 | Static 82 | forRoot 83 | 84 | 85 | 86 | | 87 |
90 |
91 | forRoot()
92 | |
93 |
|
98 | Defined in src/index.ts:9
100 | |
101 |
|
106 |
107 |
108 | Returns :
111 | ModuleWithProviders<DeviceDetectorModule>
109 |
110 | |
112 |
import { NgModule, ModuleWithProviders } from '@angular/core'
121 | import { CommonModule } from '@angular/common'
122 | import { DeviceDetectorService } from './device-detector.service'
123 |
124 | @NgModule({
125 | imports: [CommonModule],
126 | })
127 | export class DeviceDetectorModule {
128 | static forRoot(): ModuleWithProviders<DeviceDetectorModule> {
129 | return {
130 | ngModule: DeviceDetectorModule,
131 | providers: [DeviceDetectorService],
132 | }
133 | }
134 | }
135 |
136 | export { DeviceDetectorService, DeviceInfo } from './device-detector.service'
137 | export { ReTree } from './retree'
138 | export * from './device-detector.constants'
139 |
140 | 1 Component
98 |1 Injectable
106 |1 Pipe
114 |2 Classes
122 |1 Interface
130 |
5 |
6 | 15 | An Angular 5+ powered AOT compatible device detector that helps to identify browser, os and other useful 16 | information regarding the device using the app. The processing is based on user-agent. 17 |
18 | 19 | 37 || Property | 75 |Value | 76 |
|---|---|
| {{ info.key }} | 80 |{{ info.value }} | 81 |
| 85 | | 86 | |
| isDesktop() | 89 |{{ isDesktop }} | 90 |
| isMobile() | 93 |{{ isMobile }} | 94 |
| isTablet() | 97 |{{ isTablet }} | 98 |
2 |
3 |
10 | An Angular 6+ 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. This library was built at KoderLabs, which is one of the best places I've worked at ❤️ 11 |
12 | 13 | 20 |
21 | Deprecated package :
22 |
23 |
24 |
26 | New package :
27 |
28 |
29 | If you use Angular 5, you must use v1.5.2 or earlier
30 |