I need to delete an entry from firebase using angularjs.the problem is that if I use the index then it deletes all the entries from the firebase, and if I use the key method it does nothing. Here is the code for controller.It is supposed to take key from the firebase from one of the partials.
$scope.deleteContact = function(key){
ContactList.destroy(key);
deleteAlert.show();
};
contactFactory.factory('ContactList', function($firebaseObject,$firebaseArray){
var contact = new Firebase("https://mycontactmanager.firebaseio.com/");
This is the function to delete an entry from the firebase
destroy: function(key){
contact.remove(key);
}
Here is the code for partial
<td>{{contactItem.name}}</td>
<td>{{contactItem.email}}</td>
<td>{{contactItem.phone}}</td>
<td><a href="#/contact/{{key}}" class="btn btn-success btn-xs">View Contact</a>
<button class="btn btn-danger btn-xs col-sm-offset-1" ng-click="deleteContact(key)\">Delete</button>
</td>
</tr>
</tbody>