I've got a controller:
.controller('BarCodeScanCtrl', function($scope, $cordovaBarcodeScanner) {
$scope.scanBarcode = function() {
$cordovaBarcodeScanner.scan().then(function(barcodeData) {
// Success! Barcode data is here
console.log(barcodeData.text);
alert('barcode scanned:' + barcodeData);
}, function(error) {
alert('Error');
console.log(error);
// An error occurred
});
};
});
I'm using the QR code generator: http://www.qr-code-generator.com/ but I can't seem to retrieve any of the data I'm inputting. It's returning the barCode
object the values of text
& format
properties are empty. The cancel
property is true
.
{
"cancelled": true,
"text":"",
"format": ""
}
Any ideas?
Thank you
Have uploaded a working sample in github, please have a look.
Steps:
1) Create a project
2) cd into the project
3) Add required platforms
4) Add ngcordova-min.js file to the js folder
5) Add the ngcordova
js file path in index.html just before cordova path
6) Add ngcordova
dependancy to app.js
7) Add plugin
8) Add the function in html page
9) Add the logic in controller
10) Test the app