How to disassociate angularFire bound object?

前端 未结 2 1014
闹比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!

提交回复
热议问题