I am using Angularfire2 along with Ionic2 and looking for a way to catch errors on FirebaseListObservable subscribe() function.
I am subscribing to fbData which is a FirebaseListObservable, and when I switch my browser/device offline, the (error) function is never called. I don't understand why.
My objective is to get data from the localStorage if the user is offline or firebase is not reachable.
Here is my simplified code:
export class MyService { fbData: FirebaseListObservable<any[]>; constructor(private af: AngularFire) { this.data = af.database.list('/data', { preserveSnapshot: true }); } updateData() { return new Promise<any[]>((resolve, reject) => { this.fbData.subscribe( (snapshots) => { resolve(snapshot.val()); }, (error) => console.log('error: ', error) // NEVER CALLED ); }); }