Mel Pacheco
Mel Pacheco

Reputation: 789

angularfire send existing object to new list

I have a list in firebase, I've already set up master/detail routes, and then I get the list and individual objects to render on the components. however, I need to 'vet' each object and send to an 'approved' list.

I get an error — Error: Firebase.push failed: first argument contains an invalid key ($ref) in property 'vetted.adlib'. Keys must be non-empty strings and can't contain ".", "#", "$", "/", "[", or "]"

when I try to push or update the new list with this object. I guess is because it already has a push ID,

It doesn't have to work the way I'm doing now, I just want to be able to send an item in one list to another.

thank you in advance, I apologize if the question is too broad.

Upvotes: 1

Views: 98

Answers (1)

Yevgen
Yevgen

Reputation: 4709

The reason why you get this error is because object, that you received from firebase contains $key and $exists.

To be able to push it to a new list you need to delete them manually or create an object in that won't parse those fields.

delete yourObject.$key;
delete yourObject.$exists;

Upvotes: 0

Related Questions