【发布时间】:2013-12-16 07:58:47
【问题描述】:
这里是 Angular 的新手,我有一个 ng-repeat 列表,其中包含触发删除功能的 ng-click="remove(item)" 按钮:
$scope.remove = function (item) {
console.log(item);
$scope.items.$remove(item);
};
而 $scope.items.$remove();可以很好地删除模型中的所有项目。我不完全确定如果我传递一个要删除的项目,为什么它会给我一个错误。以下是我遇到的错误。
Error: Firebase.child failed: First argument was an invalid path: "[object Object]". Paths must be non-empty strings and can't contain ".", "#", "$", "[", or "]"
at Error (<anonymous>)
at Ga (https://cdn.firebase.com/v0/firebase.js:12:230)
at H.J.F (https://cdn.firebase.com/v0/firebase.js:134:213)
at Object.object.$remove (https://cdn.firebase.com/libs/angularfire/0.5.0/angularfire.js:160:26)
at Scope.MyCtrl.$scope.removeShape (http://127.0.0.1:9000/scripts/controllers/main.js:24:23)
at http://127.0.0.1:9000/bower_components/angular/angular.js:9977:21
at http://127.0.0.1:9000/bower_components/angular/angular.js:17678:17
at Scope.$eval (http://127.0.0.1:9000/bower_components/angular/angular.js:11668:28)
at Scope.$apply (http://127.0.0.1:9000/bower_components/angular/angular.js:11768:23)
at Scope.$delegate.__proto__.$apply (<anonymous>:855:30) angular.js:9193
(anonymous function) angular.js:9193
(anonymous function) angular.js:6746
Scope.$apply angular.js:11770
$delegate.__proto__.$apply VM21684:855
(anonymous function) angular.js:17677
jQuery.event.dispatch jquery-1.9.1.js:3074
elemData.handle
提前感谢您帮助我了解正在发生的事情。
【问题讨论】:
标签: javascript angularjs angularfire