{"id":15297159,"url":"https://github.com/srfrnk/ng-device-detector","last_synced_at":"2025-04-12T22:28:13.952Z","repository":{"id":17412640,"uuid":"20185489","full_name":"srfrnk/ng-device-detector","owner":"srfrnk","description":"Angular module to detect OS / Browser / Device","archived":false,"fork":false,"pushed_at":"2022-11-22T07:15:04.000Z","size":923,"stargazers_count":240,"open_issues_count":8,"forks_count":70,"subscribers_count":20,"default_branch":"master","last_synced_at":"2024-10-30T03:41:28.157Z","etag":null,"topics":["angular","css","custom-detectors","html","javascript","ng-device-detector","user-agent","useragent","useragentparser"],"latest_commit_sha":null,"homepage":"http://srfrnk.github.io/ng-device-detector","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/srfrnk.png","metadata":{"files":{"readme":"readme.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-05-26T12:32:45.000Z","updated_at":"2023-07-25T18:30:31.000Z","dependencies_parsed_at":"2022-09-02T08:33:20.345Z","dependency_job_id":null,"html_url":"https://github.com/srfrnk/ng-device-detector","commit_stats":null,"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srfrnk%2Fng-device-detector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srfrnk%2Fng-device-detector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srfrnk%2Fng-device-detector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srfrnk%2Fng-device-detector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/srfrnk","download_url":"https://codeload.github.com/srfrnk/ng-device-detector/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248639194,"owners_count":21137798,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["angular","css","custom-detectors","html","javascript","ng-device-detector","user-agent","useragent","useragentparser"],"created_at":"2024-09-30T19:15:26.688Z","updated_at":"2025-04-12T22:28:13.927Z","avatar_url":"https://github.com/srfrnk.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ng-device-detector\n##### Angular module to detect OS / Browser / Device\n\n[![Build Status](https://travis-ci.org/srfrnk/ng-device-detector.svg?branch=master)](https://travis-ci.org/srfrnk/ng-device-detector)\n[![GitHub issues](https://img.shields.io/github/issues/srfrnk/ng-device-detector.svg)](https://github.com/srfrnk/ng-device-detector/issues)\n[![Known Vulnerabilities](https://snyk.io/package/npm/ng-device-detector/badge.svg)](https://snyk.io/package/npm/ng-device-detector)\n[![Open Source Helpers](https://www.codetriage.com/srfrnk/ng-device-detector/badges/users.svg)](https://www.codetriage.com/srfrnk/ng-device-detector)\n\n[![GitHub license](https://img.shields.io/github/license/srfrnk/ng-device-detector.svg)](https://github.com/srfrnk/ng-device-detector/blob/master/license.txt)\n[![npm](https://img.shields.io/npm/dm/ng-device-detector.svg)](https://www.npmjs.com/package/ng-device-detector) \n[![npm](https://img.shields.io/npm/dt/ng-device-detector.svg)](https://www.npmjs.com/package/ng-device-detector)\n[![npm](https://img.shields.io/npm/v/ng-device-detector.svg)](https://www.npmjs.com/package/ng-device-detector)\n\n[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)\n[![Semver](http://img.shields.io/SemVer/2.0.0.png)](http://semver.org/spec/v2.0.0.html)\n\nUses user-agent to set CSS classes or directly usable via JS.\nSee website: [http://srfrnk.github.io/ng-device-detector](http://srfrnk.github.io/ng-device-detector)\n\n### Install\nNPM\n```sh\n$ npm install ng-device-detector --save\n```\nBower\n```sh\n$ bower install ng-device-detector --save\n```\nBrowser (Add scripts in HTML)\n```sh\n\u003cscript type=\"text/javascript\" src=\".../re-tree.js\"\u003e\u003c/script\u003e\n\u003cscript type=\"text/javascript\" src=\".../ua-device-detector.js\"\u003e\u003c/script\u003e\n\u003cscript type=\"text/javascript\" src=\".../ng-device-detector.js\"\u003e\u003c/script\u003e\n```\nAdding `'ng.deviceDetector'` to your app module dependencies\n```js\nangular.module('app', ['ng.deviceDetector']);\n```\nInjecting *DeviceDetector* service in controller\n```js\nangular.module('app').controller('Home', function($scope, deviceDetector){\n  // Awesome stuff\n});\n```\n\nTo add classes, add directive like: `\u003cdiv device-detector\u003e`\n\n### Setup\n\nYou can set custom detectors at the provider object.\nThe \n```javascript\nangular.module('app', [\"ng.deviceDetector\"])\n    .config(['deviceDetectorProvider', function(deviceDetectorProvider) {\n      deviceDetectorProvider.addCustom(\"Custom_UA_Entry\", {\n        and:[\"\\\\bCustom_UA_Entry\\\\b\", {\n            not:\"\\\\bChrome\\\\b\"\n        }]\n      });\n    }])\n    \n    .controller('Home', function($scope, deviceDetector) {\n      // (true / false)\n      $scope.customUAEntry = deviceDetector.custom[\"Custom_UA_Entry\"];\n    });\n```\n\n\u003e Custom detectors will also be added as CSS classes with 'is-' prefix and encoded into css class name casing.\n\n### deviceDetector service\nHolds the following properties:\n* raw : object : contains the raw values... for internal use mostly.\n* os : string : name of current OS\n* browser : string : name of current browser\n* device : string : name of current device\n \n### Support\nAt first I added just major browser, OS, device support.\nWith help from mariendries, javierprovecho and crisandretta more support was added.\n[The current list of supported browser, OS, device can be easily viewed in here](https://github.com/srfrnk/ng-device-detector/blob/master/ng-device-detector.js).\n\nPull-requests with new stuff will be highly appreciated :)\n\n### Example\n\nSee [plunker](http://plnkr.co/edit/urqMI1?p=preview)\n\n### License\n\n[MIT License](//github.com/srfrnk/ng-device-detector/blob/master/license.txt)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsrfrnk%2Fng-device-detector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsrfrnk%2Fng-device-detector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsrfrnk%2Fng-device-detector/lists"}