jeudi 18 juin 2015

how to inject persistencejs in angularjs (undefined is not an object (evaluating 'persistence.store.cordovasql.config'))

Hello I want to use persistencejs in my angularjs/ionic mobile application. I use a sqlite database on the device.

I used this example to use persistencejs in my application but I get an error:

undefined is not an object (evaluating 'persistence.store.cordovasql.config')

In my index.html I bind the js files like this:

  <script src="lib/persistencejs/persistence.js"></script>
  <script src="lib/persistencejs/persistence.store.sql.js"></script>
  <script src="lib/persistencejs/persistence.store.sqlite.js"></script>

And in my controller I use:

  persistence.store.cordovasql.config(
  persistence,
  'testdb',
  '0.0.1',                // DB version
  'DB',                   // DB display name
  5 * 1024 * 1024,        // DB size
  0                       // SQLitePlugin Background processing disabled
  );

  persistence.define('Page', {
    path: "TEXT",
    data: "TEXT"
  });

  persistence.schemaSync();

What am I missing?

Aucun commentaire:

Enregistrer un commentaire