Last active
August 29, 2015 14:00
-
-
Save mlynch/11058080 to your computer and use it in GitHub Desktop.
Reusable cordova plugin wrapping service service
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('myApp.services', []) | |
.factory('Camera', ['$q', function($q) { | |
return { | |
getPicture: function() { | |
var q = $q.defer(); | |
navigator.camera.getPicture(function(imageURI) { | |
// Do any magic you need | |
q.resolve(imageURI); | |
}, function(err) { | |
q.reject(err); | |
}); | |
return q.promise; | |
} | |
} | |
}]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Then, use in your controllers: