删除行的问题 - AngularJS和Firebase

时间:2016-02-22 16:46:29

标签: angularjs firebase

我遇到的问题是,如果我有2行或更多行,然后想要删除单行,它会同时删除所有行。也许他们是否有联系,奇怪的行为。

在我添加OrderByPriority以搜索表格后,出现了此问题。如果我删除OrderByPriority我可以单独删除行,但是我无法搜索...有没有办法可以搜索表格,还能删除单行而不会同时删除所有行只需删除一行。

开放的想法和inpus。

Click here for plunker

index.html中的部件快照:

<table class="table table-striped">
      <thead>
        <tr>
          <th>#</th>
          <th>Plate Number</th>
          <th>Description</th>
          <th>Price</th>
          <th></th>
        </tr>
      </thead>
      <tbody>
        <tr ng-repeat="(id, item) in items | orderByPriority | filter:search">
          <td>

1 个答案:

答案 0 :(得分:0)

传递firebase项$id以删除firebase上的实际行

ng-click="removeItem(item.$id)"

item。$ id由firebase生成,并且在所有元素中都是唯一的;所以,你必须通过这个$ id删除实际项目。