You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 4, 2020. It is now read-only.
Hi how are you? I need your help because I have implemented your library for an ionic app and I need the following:
I need to know how to do to point to a particular namespace created with angularfire2. Basically I need to be able to create a new instance of AngularFireOfflineDatabase from an ionic component.
Ex:
new AngularFireOfflineDatabase (AngularFireDatabase, token, LocalUpdateService);
In this case I would like to be able to pass a particular instance of AngularFireDatabase. The token and LocalUpdateService do not know how to pass it.
Basically my application needs to connect to different firebase database of the same project. With angularfire2 I was able to do this but with AngularFireOffline it always points to the global connection of angularfire2.
My service look that and I have problem with LOCAL_UPDATE_SERVICE_PROVIDER :
import { Injectable } from "@angular/core";
import { Events } from 'ionic-angular';
import { AngularFireOfflineDatabase } from 'angularfire2-offline';
import { LOCALFORAGE_PROVIDER, LocalForageToken } from 'angularfire2-offline/database/offline-storage/localforage';
import { LocalUpdateService, LOCAL_UPDATE_SERVICE_PROVIDER } from 'angularfire2-offline/database/offline-storage/local-update-service';
/** 3rd-party imports */
import { AngularFireDatabase, FirebaseListObservable, FirebaseObjectObservable } from "angularfire2/database";
import { _firebaseAppFactory } from "angularfire2/firebase.app.module";
import { FirebaseAppConfig } from "angularfire2";
import firebase from 'firebase/app';
@Injectable()
export class FirebaseService {
private _db: AngularFireDatabase;
constructor(public events: Events) {
events.subscribe('workspace:selected', (config, firebaseAppName) => {
console.log("Event workspace:selected called");
this.initFirebaseApp(config, firebaseAppName);
});
}
/** Function to initialize firebase application and
* get DB provider for the corresponding application.
*/
public initFirebaseApp(config: FirebaseAppConfig, firebaseAppName: string) {
//firebase.app().delete().then(() => {
//const secondAppConfig = firebase.initializeApp(config);
this._db = new AngularFireDatabase(_firebaseAppFactory(config, firebaseAppName));
let dboffline = new AngularFireOfflineDatabase(this._db, LOCALFORAGE_PROVIDER, LOCAL_UPDATE_SERVICE_PROVIDER);
dboffline.list("projects").subscribe((projects) => {
console.log("afoDatabase called");
console.log(projects);
})
//});
}
/** Function to get firebase DB list */
public getList(path: string): FirebaseListObservable<{}> {
return this._db.list(path);
}
/** Function to get firebase DB object */
public getObject(path: string): FirebaseObjectObservable<{}> {
return this._db.object(path);
}
public db() {
return this._db;
}
}```
Thank you.
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hi how are you? I need your help because I have implemented your library for an ionic app and I need the following:
Ex:
new AngularFireOfflineDatabase (AngularFireDatabase, token, LocalUpdateService);
In this case I would like to be able to pass a particular instance of AngularFireDatabase. The token and LocalUpdateService do not know how to pass it.
Basically my application needs to connect to different firebase database of the same project. With angularfire2 I was able to do this but with AngularFireOffline it always points to the global connection of angularfire2.
My service look that and I have problem with
LOCAL_UPDATE_SERVICE_PROVIDER
:The text was updated successfully, but these errors were encountered: