|
1 | | -adaptive-detection |
2 | | -================== |
| 1 | +# adaptive-detection v0.1.0 [](https://travis-ci.org/angular-adaptive/adaptive-detection) |
| 2 | + |
| 3 | +This module allows you to detect iOS and Android devices using user agent string |
| 4 | + |
| 5 | +# Requirements |
| 6 | + |
| 7 | +- AngularJS v 1.0+ |
| 8 | + |
| 9 | +# Usage |
| 10 | + |
| 11 | +We use [bower](http://twitter.github.com/bower/) for dependency management. Add |
| 12 | + |
| 13 | + dependencies: { |
| 14 | + "angular-adaptive-detection": "latest" |
| 15 | + } |
| 16 | + |
| 17 | +To your `bower.json` file. Then run |
| 18 | + |
| 19 | + bower install |
| 20 | + |
| 21 | +This will copy the angular-isbn files into your `bower_components` folder, along with its dependencies. Load the script files in your application: |
| 22 | + |
| 23 | + <script type="text/javascript" src="components/angular/angular.js"></script> |
| 24 | + <script type="text/javascript" src="components/angular-adaptive/adaptive-detection/src/adaptive-detection.js"></script> |
| 25 | + |
| 26 | +Add the **adaptive.detection** module as a dependency to your application module: |
| 27 | + |
| 28 | + var myAppModule = angular.module('MyApp', ['adaptive.detection']); |
| 29 | + |
| 30 | +and include $detection provider as a dependency to your controller: |
| 31 | + |
| 32 | + angular.module('MyApp').controller('MainCtrl', function ['$scope', '$detection', ($scope, $detection) { |
| 33 | + |
| 34 | + }]); |
| 35 | + |
| 36 | +### Configuration |
| 37 | + |
| 38 | +You can configure provider to a custom User Agent string in app configuration. |
| 39 | + |
| 40 | + $detection.setUserAgent('angular browser'); |
| 41 | + |
| 42 | +### Public methods |
| 43 | + |
| 44 | +You can detect Android and iOS devices using: |
| 45 | + |
| 46 | + $detection.isAndroid(); |
| 47 | + $detection.isiOS(); |
| 48 | + |
| 49 | + |
| 50 | +# Contributing |
| 51 | + |
| 52 | +Contributions are welcome. Please make a pull request against canary branch and do not bump versions. Also include tests. |
| 53 | + |
| 54 | +# Testing |
| 55 | + |
| 56 | +We use karma and jshint to ensure the quality of the code. The easiest way to run these checks is to use grunt: |
| 57 | + |
| 58 | + npm install -g grunt-cli |
| 59 | + npm install |
| 60 | + bower install |
| 61 | + grunt |
| 62 | + |
| 63 | +The karma task will try to open Chrome as a browser in which to run the tests. Make sure this is available or change the configuration in `test/test.config.js` |
| 64 | + |
| 65 | +# License |
| 66 | + |
| 67 | +The MIT License |
| 68 | + |
| 69 | +Copyright (c) 2013 Jan Antala, https://github.com/janantala |
0 commit comments