Update README.md

This commit is contained in:
Max Lynch 2016-07-28 09:28:58 -05:00 committed by GitHub
parent 2c01d1998f
commit d3d14d0b86

View File

@ -31,6 +31,24 @@ let watch = Geolocation.watchPosition().subscribe(pos => {
watch.unsubscribe();
```
### Angular 1
Ionic Native works as a stand-in for [ngCordova](http://ngcordova.com/). In many cases, the usage is identical, but we import `ionic.native` instead of `ngCorodva` as our module.
As a rule of thumb: take the ES6 class name of the plugin and add `$cordova` to get the service name. For example, `Geolocation` would be `$cordovaGeolocation`, and `Camera` will be `$cordovaCamera`:
```javascript
angular.module('myApp', ['ionic', 'ionic.native'])
.controller('MyCtrl', function($scope, $cordovaCamera) {
$scope.takePicture = function() {
$cordovaCamera.getPicture(opts).then(function(p) {
}, function(err) {
});
};
});
```
### Runtime Diagnostics
Spent way too long diagnosing an issue only to realize a plugin wasn't firing or installed? Ionic Native lets you know what the issue is and how you can resolve it.