Open itsrnd opened 8 years ago
Hello Guys,
I have written the following code, but when my android 4.4 device reach at **"$cordovaBarcodeScanner.scan().then(function(imageData)"** my app gives error **"Unfortunately app stopped working"**. Any body can help?
exampleApp.controller("ExampleController",function($scope,$cordovaBarcodeScanner){ $scope.scanBarcode = function(){ alert("In function"); $cordovaBarcodeScanner.scan().then(function(imageData){ alert("In function1"); //alert("Format = "+imageData.format); document.getElementById('customer_bar_id').value = imageData.text; alert("In function2"); $('#customer_bar_id').show(); alert("In function"); $('#customer_bar_search').show(); },function(error){ alert("An error happened = "+error); }); } });
But why you using jQuery? This is angular, so you can use built-in jqLite or native dom api.
Hello Guys,
exampleApp.controller("ExampleController",function($scope,$cordovaBarcodeScanner){ $scope.scanBarcode = function(){ alert("In function"); $cordovaBarcodeScanner.scan().then(function(imageData){ alert("In function1"); //alert("Format = "+imageData.format); document.getElementById('customer_bar_id').value = imageData.text; alert("In function2"); $('#customer_bar_id').show(); alert("In function"); $('#customer_bar_search').show(); },function(error){ alert("An error happened = "+error); }); } });