小编moe*_*ans的帖子

来自二级对象的Firebase $ id

所以我在firebase中有这个例子

clients {
   //clients with unique keys {
       invoices: {
         // Invoices with unique Keys
       }
   }
}
Run Code Online (Sandbox Code Playgroud)

我正在用一个ref返回所有这些,如下所示:

.controller('singleClientController', function($scope, $firebaseObject, fbUrl, $routeParams) {

    var id = $routeParams.id;

    var singleRef = new Firebase(fbUrl+'/clients/'+id);
    var client = this;

    client.details = $firebaseObject(singleRef);

})
Run Code Online (Sandbox Code Playgroud)

所以在我的HTML中,我试图返回$id客户端和发票.我能够让客户端没有问题{{client.details.$id}}但是当我尝试用发票ID {{invoice.$id}}做同样的事情时我什么也得不到.

发票通过foreach显示如下:

<tr ng-repeat="invoice in client.details.invoices">
     <td>
         <a href="#/invoices/details/{{invoice.$id}}/{{client.details.$id}}">
            {{invoice.settings.number}}
         </a>
     </td>
     ...
</tr>
Run Code Online (Sandbox Code Playgroud)

是因为发票在客户内吗?如果是这样,您将如何返回发票的ID?这让我疯了!请帮忙!

为了更好地理解我的firebase设置,这里是我正在谈论的截图.

在此输入图像描述

javascript angularjs firebase angularfire

4
推荐指数
1
解决办法
719
查看次数

标签 统计

angularfire ×1

angularjs ×1

firebase ×1

javascript ×1