How to disassociate angularFire bound object?

前端 未结 2 979
闹比i
闹比i 2021-01-13 16:18

I am using AngularJS and FireBase in my application. I bound an object to be in sync with FireBase:

$scope.winnerPromise = angularFire(travelBidsFirebaseRef          


        
相关标签:
2条回答
  • 2021-01-13 17:19

    The disassociate function is passed to you when the promise is resolved. I'd use it as follows:

    var ref = travelBidsFirebaseRef.child("user/" + $scope.auction.winnerUserId);
    var promise = angularFire(ref, $scope, "winner", {});
    promise.then(function(disassociate) {
      // Do some work...
      disassociate(); // Don't synchronize $scope.winner anymore.
    });
    

    Hope this helps!

    0 讨论(0)
  • 2021-01-13 17:23

    I am using angularfire and for me it worked the $destroy method.

    https://github.com/firebase/angularfire/blob/master/docs/reference.md#destroy-1

    0 讨论(0)
提交回复
热议问题