3

I'm doing an angularjs app using google maps api v3 and a plugin called ng-map. But I want to store some coordinates in a SQLite database and then retrieve from the app.

4 Answers 4

3

Basically, you can not. But you can use a SQLite cordova plugin if you are developing a hybrid mobile application.

http://ngcordova.com/docs/plugins/sqlite/ is one of the best SQLite plugins for cordovajs.

Sign up to request clarification or add additional context in comments.

2 Comments

I'm trying the solution you told me. I setup successfully the plugins. No errors.. But It doesn't query
I have done with that plugin, but is only compatible with chrome
1

If you are looking for a cross-browser data storage mechanism, you can use IndexedDB.

http://www.w3.org/TR/IndexedDB/

https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API

5 Comments

Can I use IndexedDB offline ?
Its not whether IndexedDB can be used offline, its whether the app works offline. If you use a HTML5 appcache manifest, you can use it offline. That's how our offline HTML5 app works. Are you looking at doing an in-browser app, or a hybrid app using something like Ionic?
I'm trying to do an in-browser app.
In that case, you will want to look at the HTML5 appcache manifest to make sure your pages are available offline, then you can also use IndexedDB offline. This will work on Safari, Chrome and Internet Explorer
@JonathanSmith could you please provide some more information on how to develop an offline HTML5 app?
1

I was looking for the same thing few days before, after googling a lot I found this angular-sqlite package which kind of helped me, we have 2 options

  1. angular-sqlite package
  2. ngCordova

Try of this helps you

      .constant('DB_CONFIG', {
        client: {
            id: key,
            name: { type: 'text', null: false },
            email: { type: 'text' },
            id_zone: { type: 'integer' }
        },
        zone: {
            id: 'key',
            name: { type: 'text', null: false }
        }
    })
    .run(function ($SQLite) {
        $SQLite.dbConfig({
            name: 'my-browser-db',
            description: 'Test DB',
            version: '1.0'
        });
    })

    .run(function ($SQLite, DB_CONFIG) {
        $SQLite.init(function (init) {
            angular.forEach(DB_CONFIG, function (config, name) {
                init.step();
                $SQLite.createTable(name, config).then(init.done);
            });
            init.finish();
        });
    });

Comments

0

I know this is old, but...if you have node, fire up a node server and communicate with that via your angular app. Node has a SQLite plugin

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.