$push({new:'record'}) to child of $firebase reference?
See original GitHub issueI have a $firebase
ref to ‘a/b’ and wish to push a new record to ‘a/b/c’ (i.e. have firebase create new key with value {new:‘record’}), such that it will result in: a/b/c/-Joi2392d09
with {new:‘record’} as its value.
How do I go about doing this?
// Setup
var db = new Firebase('https://example.firebaseio.com/');
$scope.remote = $firebase(db.child('a/b')).$asObject();
// How do we push to a/b/c?
$scope.remote.c.$push({new:'record'}); // error - $push is not a function.
I can try using $inst()
, but i can only push to ‘a/b’; I do not know how to $push a record to a child of the reference. Any ideas?
Thank you! Love the changes to the API in the latest release.
Issue Analytics
- State:
- Created 9 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
$push({new:'record'}) to child of $firebase reference? #402
I have a $firebase ref to 'a/b' and wish to push a new record to 'a/b/c' (i.e. have firebase create new key with...
Read more >Saving Data | Firebase Realtime Database - Google
Every time you push a new node onto a list, your database generates a unique key, ... The data for your app is...
Read more >Add an item to a list in Firebase Database - Stack Overflow
The basic flow for inserting new record is as follows: private DatabaseReference mDatabase; // get reference to your Firebase Database.
Read more >Creating custom key for new record in Realtime Database ...
Creating custom key for new record in Realtime Database Firebase | Angular. · import { AngularFireDatabase } from '@angular/fire/database'; · this.dbRef.child(` ...
Read more >AngularFire - A real-time backend for AngularJS from Firebase.
This is the equivalent of calling push(value) on a Firebase reference. ... If a key is provided, it sets the value of a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
There’s really no need for $child. You can use any ref to create a $firebase object (which is probably not necessary, since you can just drop to the API level).
@irfaan +1