result of barcode scan does not write back to inputs


I have 2 input boxes names deviceid and companyid. I’m using Ionic Creator to design the layout.

To fill this information the user can scan a QR code which returns a value Config:12345:mycompany.

This information is then split and should be written back to the input boxes, but this is not happening.

The input boxes have the name”deviceid” and Angular Directive ng-model”deviceid” and name”companyid” and Angular Directive ng-model”companyid”.

The scanning process works fine and the data is collected but is not displayed in the input boxes unless I initiate another scan, then the values appear inside the input boxes.

This is my first foray into Angular.js having to migrate an app from XDK which worked fine.

The QR scan code is below:-

 function ($scope, $stateParams) {
    $scope.radioCheck  "security";
    $scope.scanQR  function (){
            function (result) {
            var TagResponse  result.text;
            var config  TagResponse.indexOf("Config:");
            if (TagResponse ! '') {
                if (config  0) {
                    var ConfigVals  TagResponse.split(':');
                    $scope.deviceid  ConfigVals[1];
                    $scope.companyid  ConfigVals[2];
       return false;


Try $scope.$apply()

Answer by Paresh Gami in a comment.

Answered By – Frank Nicklin

Leave a Comment