문제

My $scope has:

$scope.current_account_key - key from my update modal

$scope.current_account which has a name: $scope.current_account.name, and a description $scope.current_account.description (account is my entry)

I want to update an entry in Firebase with these values.

Firebase tree:

accounts
    -JL7e0Obv18-Ls6TTkk8
        description
        name
도움이 되었습니까?

해결책

You can do it in two ways.

You can get accounts and get the specific child and update and save the child

var ref = new Firebase(fbUrl + '/accounts');
var accounts = $firebase(ref);

var child = accounts.$child(key);
// Set any value to child and save
// child.name = 'changed name';
child.$save();

(Or)

Get the child element directly

var ref = new Firebase(fbUrl + '/accounts/' + key);
$scope.account = $firebase(ref);

// Set any value to account and save
// account.name = 'changed name';
$scope.account.$save();
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top