Currently the providers automatically unwrap the DataSnapshots returned from the Firebase database.
Should we provide an option to keep the DataSnapshot intact?
class MyComponent {
constructor(private af: AngularFire) {
const obj = af.object('/name', { snapshot: true });
obj.subscribe((snap) => {
console.log(snap);
});
}
}
Or perhaps we could use generics
class MyComponent {
constructor(private af: AngularFire) {
const obj = af.object<DataSnapshot>('/name');
obj.subscribe((snap) => {
console.log(snap);
});
}
}
How about unwrapped by default, with an option to preserve the snapshot:
class MyComponent {
constructor(private af: AngularFire) {
const obj = af.object('/name', {preserveSnapshot: true});
obj.subscribe((snap) => {
console.log(snap);
});
const obj = af.object('/other');
obj.subscribe((pojs) => {
console.log(pojs);
});
}
}
Hi @davideast & @jeffbcross ,
I am really want to know what kind of scenario we should use preserveSnapshot: true ? I could not find the usage of the 'preserveSnapshot' on the docs
Thank you
Most helpful comment
Hi @davideast & @jeffbcross ,
I am really want to know what kind of scenario we should use preserveSnapshot: true ? I could not find the usage of the 'preserveSnapshot' on the docs
Thank you