Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8585059
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T21:58:04+00:00 2026-06-11T21:58:04+00:00

I am using Cordova and Angular for a small webapp. Here is the implementation

  • 0

I am using Cordova and Angular for a small webapp. Here is the implementation process:

  1. LogsModel is created
  2. queryLogs() is called
  3. getLogsArray() is called – at this point, even in the function definition, console.log(this.logs['0']) returns undefined. I do not understand why.

LogsModel.prototype.logs = {};

LogsModel.prototype.getLogsArray = function (){
    console.log(this.logs['0']);
    return this.logs;
};

LogsModel.prototype.queryLogs = function (){

    var self = this;

    function getFromDb (tx){
        tx.executeSql('SELECT * FROM DEMO',[],querySuccess,self.query_fail);
    }

    function querySuccess(tx,results){
        var len = results.rows.length;

        for(var i = 0; i < len; i++){

            var log = {
                verb: results.rows.item(i).verb
            };
            self.logs[i]= {
                verb: results.rows.item(i).verb
            };
        }
    }
    this.db = window.openDatabase("Database","1.0","Cordova Demo",200000);
    this.db.transaction(getFromDb,self.transaction_fail);
};
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T21:58:05+00:00Added an answer on June 11, 2026 at 9:58 pm

    queryLogs is an asynchronous task. Call getLogsArray directly after starting the transaction and the array won’t be populated yet.

    Instead, use a callback which you invoke from the querySuccess function to continue processing (e.g. logging results).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Phonegap (Cordova) v1.9, and this app is solely for iPhone4+ use. I've
I am using JQM 1.1.0 and Cordova 1.5.0. I have code like this <!DOCTYPE
I just created a new project using the visual studio cordova starter template. However
I am using Cordova 1.8.1 in xcode 4.3.3 and trying to add the ChildBrowser
I'm using Cordova 1.9.0 for an Android App. The same code, on IOS works
I am using phonegap cordova-1.5.0.js and jar. and using the phonegap-plugins for cordova with
I am trying to write a file in android using phonegap cordova 1.5.0. Below
I've to develop a simple Android app using the Cordova API(PhoneGap) and it requires
I'm building an hybrid Android App using Phonegap/Apache Cordova. My app should get data
Using NSDateComponents I know how to get the day component, but this gives me

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.