cordovaBarcodeScanner stoped working: empty object


#1

Hi everybody,

I’m in troubles because some days ago i successfully integrated $cordovaBarcodeScanner in my Ionic App and it worked great.

$scope.scanBarcode = function() {
    $cordovaBarcodeScanner.scan().then(function(imageData) {
    	//EAN CODE READED: imageData.text
        console.log("Barcode Format -> " + imageData.format);
        console.log(imageData.text);
        $scope.data.barcode = imageData.text;
    }, function(error) {
        console.log("An error happened -> " + error);
    });
};

Today, it started not working. No errors happens, but the camera is not loading. I placed a console.log($cordovaBarcodeScanner) and it returns an empty object “{}” :-?

This is the head of my index.html

<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<title></title>

<link href="lib/ionic/css/ionic.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">

<!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above
<link href="css/ionic.app.css" rel="stylesheet">
-->

<!-- ionic/angularjs js -->
<script src="lib/ionic/js/ionic.bundle.js"></script>

<!-- angular storage -->
<script src="lib/a0-angular-storage/dist/angular-storage.js"></script>

<!-- Auth0 Lock -->
<script src="lib/auth0-lock/build/auth0-lock.js"></script>
<!-- auth0-angular -->
<script src="lib/auth0-angular/build/auth0-angular.js"></script>
<!-- angular-jwt -->
<script src="lib/angular-jwt/dist/angular-jwt.js"></script>

<script src="lib/ngCordova/dist/ng-cordova.js"></script>
<!-- cordova script (this will be a 404 during development) -->
<script src="cordova.js"></script>

<!-- your app's js -->
<script src="js/app.js"></script>
<script src="js/controllers.js"></script>
<script src="js/services.js"></script>

And this is my app.js file: http://pastebin.com/AxSXWU40

Any idea?


#2

I solved removing and re-adding the barcode plugin to my project.