Skip to content

Make it easy to access the per item firebase refs. #180

Open
@anachirino

Description

@anachirino

If you add res['.ref'] = _getRef(snapshot) to the createRecord function. Like:

function createRecord (snapshot) {
  var value = snapshot.val()
  var res = isObject(value)
    ? value
    : { '.value': value }
	res['.key'] = _getKey(snapshot)
	res['.ref'] = _getRef(snapshot);
  return res
}

Then we can more easily access the firebase reference that is associated with a given item. The example in the readme could be changed from:

deleteItem: function (item) {
   this.$firebaseRefs.items.child(item['.key']).remove()
}

to:

deleteItem: function (item) {
   item['.ref'].remove()
}

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