Use QrCode to Read/Scan the selection of users


#1

Hi,

I’m trying to use QRCode (https://github.com/LazarSoft/jsqrcode) for Read/scan in a Cordova application. The response of QRCode is in a qrcode.result variable.

I’need watch the result of QrCode in a div and then change the navigation of the user in function of the QrCode (for example “C1” for go to contact.html, “H2” to go to help, etc).
I’m tryin it in different manners but stil not working.

The index.html code is :

    <!--display video webCam-->
    <div id="outdiv"></div>
    
    <div class="row">    
        <div id="centerP" class="col-33"></div>
        <div id="centerP" class="col-10"></div>
        
        <div id="result" class="col">{{result}}</div>
        
        <!--display result
        
        <div ng-include="scanQrCode()"></div>
        <div id="result" class="col">{{text}}</div>
        
        <div ng-switch on="result">                    
            <div ng-switch-when="C1" ng-include="'templates/contacts.html'" ></div>                      
            <div ng-switch-when="F1" ng-include="'templates/films'" ></div>                                          
        </div> 

        
        <div ng-include="result === 'C1' ? 'templates/contacts.html' : ''"></div>
        <div ng-include="result === 'F1' ? 'templates/films.html' : ''"></div>
        <div ng-include="result === 'H1' ? 'templates/help.html' : ''"></div>
        -->

        <div id="centerP" class="col-10"></div>
        <div id="centerP" class="col-33"></div>
    </div>    

  </div>

and the controller is :

$scope.$watch(function() {
    return qrcode.result;
}, function(newVal){
    $scope.result = newVal;
}, true);  
    
$scope.scanQrCode = function() {
    $scope.text=qrcode.result;
    if(qrcode.result = 'C1'){
        return "templates/contacts.html";
    } else 
        if (qrcode.result = 'F1'){
            return "templates/films.html";
        }
        else 
            if (qrcode.result = 'H2'){
                return "templates/help.html";
            }
    else return "templates/home.html";
};

The problem is that my solution not works correctly. How i can obtain the navigation in function of the Scanned QrCode ?
Could you somebody help-me ?


#2

You can test this qr code scanner library. I think it can help you with your work.