Stv
Stv

Reputation: 506

AngularJS BarcodeScanner plugin

I'm working on a cordova app with a barcode scanner. I have already added the plugin with: cordova plugin add https://github.com/wildabeast/BarcodeScanner.git (it worked fine in my first app app but it was built on ionic framework, dunno if it have something to do with that) So, when i just call:

function barcodeCtrl($scope, $cordovaBarcodeScanner)
{
    $scope.scanBarcode = function() {
            $cordovaBarcodeScanner.scan().then(function(imageData) {
                alert(imageData.text);
                console.log("Barcode Format -> " + imageData.format);
                console.log("Cancelled -> " + imageData.cancelled);
            }, function(error) {
                console.log("An error happened -> " + error);
        });
    };
}

I have the error:

Error: [$injector:unpr] http://errors.angularjs.org/1.2.27/$injector/unpr?p0=ordovaBarcodeScannerProvider

i've tryed to comment the content on the function, still the same, sound like a problem with the $cordovaBarcodeScanner injection.

Thanks in advance.

Upvotes: 0

Views: 4614

Answers (1)

Luiz Almeida
Luiz Almeida

Reputation: 21

Have you included the ng-cordova.js?
Check this out: http://ngcordova.com/docs/

Upvotes: 2

Related Questions