AngularFire / Firebase - How Do You Delete Key That is More Than One Level Deep? -
i have synced object initialized this:
var sync = $firebase(ref); var syncobject = sync.$asobject(); syncobject.$bindto($scope, 'data');
the synced object has following structure:
{ levelone: { leveltwo: { valueone: 1 valuetwo: 2 } } }
i remove 1 of values $remove()
, not able delete other entire object method.
the following delete entire object:
syncobject.$remove('levelone.leveltwo.valueone');
i not want use $save()
overwrite entire synced object.
is there anyway remove nested key $remove()
?
there no way drill through multiple layers $remove()
function. ended using vanilla firebase js library methods delete.
var ref = new firebase(myfirebaseurl); // child() method (from vanilla js library) allows target keys // more 1 level deep ref.child('levelone/leveltwo/valueone').remove(); var sync = $firebase(ref);
you can chain child()
function off of original js firebase class object , run remove()
method off of (notice remove()
method , not $remove()
method).
Comments
Post a Comment