Reputation: 504
I am struggling with a probably minor problem, but searches and work hasn't given me the clue i am looking for. Here is the deal :
When i call $scope.postit.$remove(post);
where postit is a synced array to firebase and post the element object i want to remove, firebase is showing the deletion in the backend (object gets all red) but re-add the element automatically (same object with same key all-green doubles the about to be deleted object).
beside, i am adding and saving all right...
Note that my security parameters are from origin, all read and write permissions.
Thank you all
code (heavily reduced to essential) :
index.html
<div ng-controller="postitCtrl">
<div class="postit" ng-repeat="post in postit">
<div class="close" ng-click="postit.$remove(post);"><i class="fa fa-times"></i></div>
<div class="title">title</div>
<div class="content">title</div>
</div>
</div>
app.js
var app = angular.module("sampleApp", ["firebase"]);
app.controller("postitCtrl", function($scope, $firebaseArray,$location) {
$scope.ref = new Firebase("https://postonit.firebaseio.com/postit");
$scope.postit = $firebaseArray($scope.ref);
});
Same when i put the remove in a fonction of my controler.
Upvotes: 0
Views: 52
Reputation: 504
So... actually i had a function calling a $save()
at any click. I overlooked it because i would't think this would then duplicate the deleted object.
So, i just made sure my $save()
wasn't called at the same moment as $remove()
and i'm all set up now.
Thanks to all anyway
Upvotes: 1