1

I'm trying to implement sync feture in an ionic 2 project using CouchBase sync gateway and CouchBase Lite Cordova Plugin

The only method they provide is getUrl() method. Using that we can do CRUD operations to local CouchBase Lite. But I could't find a way to invoke sync process with CouchBase Sync gateway. Any one knows how to implement sync process.

code example I'm using

constructor(private couchbase: CouchbaseLite, private platform:Platform,private _http:Http) {
   this.initMethod();
}

url:string;
initMethod() {
   this.couchbase.getURL().then((url)=> {
       this.url = url;
   })
}

getUrl() {
     return this.url;
}

// DATABASES //
createDatabase(database_name:string) {
     let url = this.getUrl();
     url = url+database_name;
     return this._http
       .put(url)
       .map(data => { this.results = data['results'] })
       .catch((error:any) => {
          return Observable.throw(error.json() || 'Couchbase Lite error');
        })
 }
Ajantha Bandara
  • 1,473
  • 15
  • 36

0 Answers0