只需使用 AngularFire CRUD 应用程序即可完成。我的问题是弄清楚如何为重复的项目动态生成 Firebase 引用,以便我可以 .remove() 它。认为也许“这个”会有效,但不是。我能够推送和编辑,只是坚持如何删除 ng-repeat 中的内容。
谢谢,
应用程序在这里: http: //powerful-stream-7060.herokuapp.com/#/admin
HTML
<div id="team" ng-hide ng-repeat="teamMember in team">
<h4><div ng-model="teamMember.name" contentEditable>{{teamMember.name}}</div></h4>
<code><div ng-model="teamMember.imgUrl" contentEditable>{{teamMember.cost | noFractionCurrency}}</div></code>
<p><div ng-model="teamMember.position" contentEditable></div></p>
<button ng-click="removeItem()" style="color:red;">[x]</button>
</div>
JS
var teaUrl = new Firebase("https://eco-grow.firebaseio.com/team");
angularFire(teaUrl, $scope, "team");
$scope.teammate = {};
$scope.teammate.name = "";
$scope.teammate.position = "";
$scope.teammate.imgUrl = "";
$scope.scout = function() {
teaUrl.push($scope.teammate);
}
$scope.removeItem = function () {
$scope.ref().remove(this);
};