I'm using firebase in angular/ionic 2 and I need to check if a value exists and to create it if it doesn't however firebase is not returning null as it states in the docs and my check does not run because of it.
subscribeToOffer(uid, offerID) {
var path = 'users/' + uid + '/offers/' + offerID;
this.rootRef.child(path).on('value', subscribed => {
if (subscribed.val() !== null) {
console.log('subscribed');
} else {
console.log('not subscribed');
}
});
}