Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there anyway to call the var resultDiv in ng-model? #29

Open
Manoj27893 opened this issue Dec 16, 2016 · 6 comments
Open

Is there anyway to call the var resultDiv in ng-model? #29

Manoj27893 opened this issue Dec 16, 2016 · 6 comments

Comments

@Manoj27893
Copy link

var resultDiv;

document.addEventListener("deviceready", init, false);
function init() {
document.querySelector("#startScan").addEventListener("touchend", startScan, false);
resultDiv = document.querySelector("[ng-model='user.result']");
}
function startScan() {

    cordova.plugins.barcodeScanner.scan(
        function (result) {
            //var s = result.text;
            var s = result.text;
            resultDiv.innerHTML = s;
        }, 
        function (error) {
            alert("Scanning failed: " + error);
        }
    );

}
@cfjedimaster
Copy link
Owner

Can you please tell me which demo you are talking about?

@Manoj27893
Copy link
Author

Hi cfjedimaster,
For barcode scanner example..
I want the result.text to be filled automatically in input so that i can submit it to my DB using mysql.

Thanks in advance ....

@cfjedimaster
Copy link
Owner

If Angular 1, just use a $scope variable. You would store 's' to it.

@Manoj27893
Copy link
Author

That Means i have to write $scope.s = result.text; so that it will store the result.text value in s and i call the value of variable 's' in my form like:

It will filled in the input field automatically ?

@cfjedimaster
Copy link
Owner

Um, not quite sure I get your reply, but sure. :) You are now asking a basic AngularJS question - nothing specific to my code or Cordova.

@Manoj27893
Copy link
Author

yes sir... I figured it out .... Thanks for your help :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants