I'm not sure how's it done, thanks!
I think we have to wait for the Alpha release. I hope it's done soon.
@kdenz @doczoidberg AF2 is currently in Alpha, and those methods are already available! 馃帀
Here's an example!
class MyComp {
questions: FirebaseListObservable<any[]>;
value: FirebaseObjectObservable<any>;
constructor(af: AngularFire) {
this.questions = af.database.list('/questions');
this.value = af.database.object('/value');
}
addToList(item: any) {
this.questions.push(item);
}
removeItemFromList(key: string) {
this.questions.remove(key).then(_ => console.log('item deleted!'));
}
deleteEntireList() {
this.questions.remove().then(_ => console.log('deleted!'));
}
setValue(data: any) {
this.value.set(data).then(_ => console.log('set!'));
}
updateValue(data: any) {
this.value.update(data).then(_ => console.log('update!'));
}
deleteValue() {
this.value.remove().then(_ => console.log('deleted!'));
}
}
The total list of methods are here:
af.database.list
push(newItem: any): PromiseWithFirebase<void>update(value: any): Promise<void>remove(key?: string): Promise<void> (if you all remove with a key, it will remove the item, if you all remove with null or no param it will delete this list)af.database.object
set(value: any): Promise<void>update(value: any): Promise<void>remove(): Promise<void>I'm closing the issue but let me know if you have any questions! I'll be adding TONS more documentation soon. Trying to get a release out first 馃槃
And pleassseee leave feedback!
Thanks for taking the time to leave an issue, it's always appreciated! 鉁岋笍
nice
I'd love to see setWitPriority in angularfire2, just sayin....
:)))
@numerized Looks like priority is on the road to deprecation, so I doubt you'll see it.
Hey @davideast, is it possible to set the name of an object with a string variable?
For example:
car: {
brands: {
var1: ''
}
}
This is the query I imagined would work:
addBrand (var1) {
var brandRef = firebase.database () .ref ().child ('car/brands');
brandRef.set ({
var1: ''
});
}
The output I get is the text var1, not its value.
Is there any way of achieving this?
@RaulGarafulic
I am going through the same problem any solutions
Hmm ok @patrickmcd so what is the way to add new data in opposite order than timestamp ?
Last added to top of the list.
I do like this:
this.myCelebsListRef.child(celebCamelName).setWithPriority(infoToSave, 0 - Date.now());
It's really practical for infinite scroll timelines that loads X new entries each time we reach the bottom.
I think you'd just add a new member to your model to take over the functionality that priority held.
...set({
stuff: 'stuff',
thing: 'thing',
fauxPriority: 0 - Date.now()
})
I usually do like this to create my infiniteLoad:
this.emoz.limitToFirst(limitToFirstNum).once('value')
I'll convert it like this then:
this.emoz.limitToLast(limitToLastNum).orderByChild("fauxPriority").once('value')
?
Just one comment from my side, at the time that I am writing you this comment, the 'Property list doesnt exist anymore on database'.
af.database.list() is no longer existed. You should use af.list(). In order to push records, you can simply use the below:
this.questions.push({...})
how to get the key value! as method 'list' doesn't contain the key! I am facing a huge problem to find example in the documentation!
@alighali85 try object.$key. That's for every object in the list
Most helpful comment
@kdenz @doczoidberg AF2 is currently in Alpha, and those methods are already available! 馃帀
Here's an example!
The total list of methods are here:
af.database.list
push(newItem: any): PromiseWithFirebase<void>update(value: any): Promise<void>remove(key?: string): Promise<void>(if you all remove with a key, it will remove the item, if you all remove with null or no param it will delete this list)af.database.object
set(value: any): Promise<void>update(value: any): Promise<void>remove(): Promise<void>I'm closing the issue but let me know if you have any questions! I'll be adding TONS more documentation soon. Trying to get a release out first 馃槃
And pleassseee leave feedback!
Thanks for taking the time to leave an issue, it's always appreciated! 鉁岋笍