Skip to content
This repository was archived by the owner on Mar 17, 2025. It is now read-only.
This repository was archived by the owner on Mar 17, 2025. It is now read-only.

$push({new:'record'}) to child of $firebase reference? #402

@irfaan

Description

@irfaan

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 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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions