Unknown provider: $cordovaBarcodeScannerProvider

Hi all,

I am new in qr code scanner, i dont know much about this.

When i am trying to add this it shows me: Unknown provider: $cordovaBarcodeScannerProvider
there is a solution on forum but for me its not working.

I am stuck in the middle of this,Please help me on this

Thanks

is this Ionic 1? if yes please refer to this link http://ngcordova.com/docs/plugins/barcodeScanner. You need to inject the BarcodeScanner in the controller I think…

i did it already but still it gives me error
i am using the example from forum to test it if it is works but no success.
.controller(‘ChatsCtrl’, function($scope, Chats,$cordovaBarcodeScanner) {

document.addEventListener(“deviceready”, function () {
$scope.scanNow = function(){
$cordovaBarcodeScanner
.scan()
.then(function(barcodeData) {
alert(barcodeData);
// Success! Barcode data is here
console.log(barcodeData);
}, function(error) {
alert(error);
// An error occurred
});

}

}, false);

have you added ngCordova to you app??.. And by the way you must test it in a real device to see if it works…

Yes i already tested, when i run the application on device it hangs on that specific page.
i just create a tab application.
installed this plugin.
write a code in controller thats it.

After googling it i found that i need to install ngCordova i did it.

but i am confusing where should i mention this ?
index.html ? app.js ? controller.js ?
i linked the ngCordova.js in index file and defined the ngCordova on controller.js on top.
But this gives me another error failed to initiate something like cannot find the module.

:confused:

check this out. The top comment says how to install ngCordova to your app https://stackoverflow.com/questions/30773320/bar-code-scanner-using-ionic-framework, another one is this http://ngcordova.com/docs/install/

Thanks Anica, i was linking wrong :smile:

Thanks man, much appreciated

I am glad you solved it, Happy coding…