Camera EncodingType undefined SOLVED


I’m trying to use some of the constants in the Camera object. I am able to use the Camera object (call getPicture()) to take and save pictures but the options have no affect and when I use Camera.EncodingType or any of the keys in Camera, they are all undefined. I threw a log in the Camera.js file below where it populates the cameraExport object with the keys and the cameraExport has all of them intact.

I’ve tried to remove the plugin and re-add it. I’ve tried to remove the platform and re-add it. Neither of these worked.

Any ideas? The comments provide a little more detail. And if you need me to provide anything else, please let me know.

.controller('PictureCtrl', function($scope, $state, $ionicPlatform, Camera) {
$scope.photo1Uri = '';
$ionicPlatform.ready(function() {
	// Checking camera object... It shows '{ }', like the object is empty.
	// When I try to do an alert on Camera.EncodingType or something else, it's undefined and will error if I try to reference the values in Camera.EncodingType.

$scope.getPhoto = function(photoId) {
	// This all works fine, except it only saves in the application directory - not the gallery.
	Camera.getPicture().then(function(photoUri) {
	$scope.photo1Uri = photoUri;      		
	}, function(err) {
		// All these config values do nothing
		// If I try to use "encodingType: Camera.EncodingType.JPEG," - the camera won't launch.
		correctOrientation: true,
		saveToPhotoAlbum: true

Thanks in advance!


I have also tried the following in my controller that gets the Camera:

$ionicPlatform.ready(function() {
	for (var key in Camera) {

It can only see the getPicture() method…


I figured out what was wrong, this was totally my bad.

I based my project off an example project and forgot the Camera object was a factory made service in services.js. Only getPicture from the plugin was exposed there.

Here is the resulting code in services.js:

.factory('Camera', ['$q', function($q) {
    return {
    getPicture: function(options) {
        var q = $q.defer();
	    // Do any magic you need
            }, function(err) {
            }, options);
        return q.promise;


I 'm getting this error on my project. The code you use works fine on the phone, but when I try it on web browser, I get : ‘TypeError: Cannot read property ‘EncodingType’ of undefined’

What could my issue be?

if i remove the cordova options i get : undefined is not an object (evaluating ‘o.DestinationType.DATA_URL’