TypeError: Cannot read property 'DestinationType' of undefined - IOS CAMERA

80 views
Skip to first unread message

Michael Hillbrand

unread,
Jan 10, 2014, 4:43:43 PM1/10/14
to phon...@googlegroups.com
hey everybody,

i struggeling for days now with this error - TypeError: Cannot read property 'DestinationType' of undefined - using cordova 3.3.0 and the camera api.
the project is build with angularjs. the plugins for the camera are already installed. i use the wrapper functions from this repo: https://github.com/mstaessen/angular-phonegap

i tried everything so far without success. 

does anybody has similar problems/issues? 

here is my exact error message:
TypeError: Cannot read property 'DestinationType' of undefined at Scope.$scope.picture (http://localhost/ionicClimbApp/platforms/ios/www/js/controllers.js:136:32) at http://localhost/ionicClimbApp/platforms/ios/www/js/angular/angular.js:9984:21 at http://localhost/ionicClimbApp/platforms/ios/www/js/angular/angular-touch.js:426:9 at Scope.$eval (http://localhost/ionicClimbApp/platforms/ios/www/js/angular/angular.js:11697:28) at Scope.$apply (http://localhost/ionicClimbApp/platforms/ios/www/js/angular/angular.js:11797:23) at Scope.$delegate.__proto__.$apply (<anonymous>:855:30) at HTMLButtonElement.<anonymous> (http://localhost/ionicClimbApp/platforms/ios/www/js/angular/angular-touch.js:425:13) at http://localhost/ionicClimbApp/platforms/ios/www/js/angular/angular.js:2586:10 at Array.forEach (native) at forEach (http://localhost/ionicClimbApp/platforms/ios/www/js/angular/angular.js:300:11)


my angular controller looks as follow:
app.controller('RegisterCtrl', ['$scope', '$http', 'Camera', function($scope, $http, Camera){

  $scope.picture = function($scope, Camera){
    Camera.getPicture(function(image) {
        $scope.$apply(function() {
            $scope.imageData = image;
        });
    }, function(error) {
        $scope.$apply(function() {
            $scope.error = error;
        });
    }, {
        destinationType: Camera.DestinationType.FILE_URL,
        sourceType: Camera.PictureSourceType.CAMERA,
        encodingType: Camera.EncodingType.JPEG,
        quality: 50
    });
  }
  

  $scope.register = function(userReg, formRegister){
    $http.post('api/add_user', userReg).success(function(data) {
      
      if (data != ''){
        $scope.wrongEntry = false;
      }else{
        $scope.wrongEntry = true;
      }
    });
  };

}]);

many thanks
Reply all
Reply to author
Forward
0 new messages