I’m using below code for barcode scanning
$cordovaBarcodeScanner.scan().then(function (imageData) {
$rootScope.$broadcast(‘scanData’, { barcode: imageData.text, currURl: $state.current.url });
console.log("Cancelled → " + imageData.cancelled);
}, function (error) {
console.log("An error happened → " + error);
});