Cannot display pouchDB collection

Hello everyone, I have a problem with my ionic app and couchDB.

I want to use couchDB with my app but that doesn’t work :frowning:

There is my stateRouter

$stateProvider

  .state('app', {
     url: '/app',
     abstract: true,
     templateUrl: 'templates/menu.html',
     controller: 'AppCtrl'
  })

  .state('app.login', {
     url: '/login',
     views: {
     'menuContent': {
        templateUrl: 'templates/login.html',
        controller: 'loginCtrl'
     }
  }
  }) 

And this is my main template

<ion-side-menus enable-menu-with-back-views="false">
  <ion-side-menu-content>
     <ion-nav-bar class="bar-calm nav-title-slide-ios7">
         <ion-nav-back-button>
         </ion-nav-back-button>

         <ion-nav-buttons side="left">
              <button class="button button-icon button-clear ion-navicon" menu-toggle="left">
              </button>
         </ion-nav-buttons>
     </ion-nav-bar>
     <ion-nav-view name="menuContent"></ion-nav-view>
   </ion-side-menu-content>

  <ion-side-menu side="left" expose-aside-when="large">
  </ion-side-menu>
</ion-side-menus>

I have no error when i add objects with (except the fact, that doesn’t display anything on my page) but when i reload my page, i see this in the js console : “An IndexedDB transaction that was not yet complete has been aborted due to page navigation”

If you have any questions, ask me :smile:

Just to say, IndexedDB is not CouchDB.

Yeah. In fact I was doing a mistake with my tests :stuck_out_tongue:

The real problem is : I cannot display my item stored in my pouchDB collection. I use this plugin https://github.com/danielzen/ng-pouchdb.
When I launch the demo, my couchDB server works fine and the collection display works too.
But when I include the collection in a controller in my ionic app, the display doesn’t work and I don’t why :confused:

Is anybody here already used this plugin?

It’s getting seriously messy here … you was talking about couchDB when it was IndexedDB … and now you are introducing pouchDB? What are you exactly using in your app and what are you trying to achieve? A snippet of your code will be good as well.

I am coding a colaborative app.
I use pouchDB to synchronize data between all devices. I never used Ionic neither angular, so sorry if I don’t explain clearly the things.

This is my controller : https://gist.github.com/kranack/6c8769a8b18c62d9d653

And this is my template : https://gist.github.com/kranack/acead43d18115236bfa6

And the problem is : angular can’t repeat on the books collection.

So, I don’t know if that’s because I have to load my database connection in my app.js or if I did a mistake in code.

Sorry didn’t looked yet at your code but using pouchDB for synchronizing data between all devices sounds really strange practice to me. Or are you just doing a simple database where any devices using your app can connect and fetch the data from?

Why is that strange in your opinion?

Hi,

This is what I asked, are you just doing a simple database where any devices using your app can connect and fetch the data from or are you talking about a real synchronization system within your devices (Like a push events)?

Well, if I only fetch data I’ll don’t use pouchdb…
I use pouchdb to get and put data to remote server and sync it with all the devices connected to this remote server

Ok, last stupid question: In your controller Line 15, are you sure you enter in the if condition?

if ($scope.online) { … }

Yep, the database replication works fine on FF, Chrome or Chromium (I checked the data with the storage tab)

Do you have the following in the config.xml file (change the wildcard with the url of your site e.g example.com for better security)

<allow-navigation href="*" />