fumito-ito / angularjs-barcodeScanner

An anglar.js wrapper around window.plugins.barcodeScanner for Phonegap/Cordova plugin
MIT License
26 stars 9 forks source link

Undefined and New version of scanner declaration #2

Open dparadox opened 10 years ago

dparadox commented 10 years ago

Hello,

I have a problem with the declaration of the factory, there is a problem for $digest already in progress.

Before You set deferred, You should check if $digest already in progress.

if(!$rootScope.$$phase ) { //$digest or $apply }

$rootScope.$apply( function () { deferred.reject(barcodeScanner_msgs['errors.barcodeScanner.undefined']); });

You have to declare scanner object like this:

var scanner = cordova.require("com.phonegap.plugins.barcodescanner.BarcodeScanner");

Thank you

micahbolen commented 10 years ago

I think I'm having the same issue. I'm not exactly sure how to fix it. @estebanlopezlumenup do you have a patch?