hypery2k / cordova-barcodescanner-plugin

barcode scanner plugin for PhoneGap
51 stars 39 forks source link

Text Box not Updating From the Result #44

Closed fihamzuher closed 6 years ago

fihamzuher commented 6 years ago

Scan Result Not Updating the View.

<label class="item item-input"><input type="text" id="txtNo" placeholder="Slip No" ng-model="Selected.barcode" /> </label>

Inside a Function, i call this but it's not getting update

cordova.plugins.barcodeScanner.scan( function (result) { $scope.Selected.barcode = result.text; }, function (error) { alert("Scanning failed: " + error); } );

$scope.Selected.barcode get the result text value but don't update the view. It will update when do the second scan time. Please help. I have used without the plugin it's work perfectly , but when i try to update in barcodeScanner success it's not working.

hypery2k commented 6 years ago

you have to call $scope.$apply() to trigger the angular change detection. It‘s more an angular issue than a plugin issue. BTW: The plugin is discontinued

fihamzuher commented 6 years ago

Thank You