Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript AngularJS+;AngularFire=如何编辑条目_Javascript_Angularjs_Angularfire_Ionic Framework - Fatal编程技术网

Javascript AngularJS+;AngularFire=如何编辑条目

Javascript AngularJS+;AngularFire=如何编辑条目,javascript,angularjs,angularfire,ionic-framework,Javascript,Angularjs,Angularfire,Ionic Framework,我的$scope具有: $scope.current\u account\u key-来自我的更新模式的key $scope.current\u account,其名称为:$scope.current\u account.name,描述为$scope.current\u account.description(账户是我的条目) 我想用这些值更新Firebase中的一个条目 Firebase树: accounts -JL7e0Obv18-Ls6TTkk8 descripti

我的
$scope
具有:

$scope.current\u account\u key
-来自我的更新模式的key

$scope.current\u account
,其名称为:
$scope.current\u account.name
,描述为
$scope.current\u account.description
(账户是我的条目)

我想用这些值更新Firebase中的一个条目

Firebase树:

accounts
    -JL7e0Obv18-Ls6TTkk8
        description
        name

你可以用两种方法来做

您可以获取帐户并获取特定子项,还可以更新和保存子项

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();
(或)

直接获取子元素

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();

非常感谢你!在我看来,我发现了一些bug,但这很有魅力(我尝试了一些类似的东西,但没有任何运气)。再一次谢谢你们。我只想问你们一个小问题。类别和记录(如帐户)的树是相同的。如果我想点击提供所有记录的类别,最佳做法是什么?记录属于类别,类别属于科目。现在,我有了一个带有这些参数的category示例:category.name、category.description和category.account(存储帐户密钥)。