我正在嘗試使用ID搜索項目,但收到此消息。所有功能都正常工作。當執行我得到這個錯誤:使用AngularFire重建項目id使用AngularFire的Firebase
Storing data using array indices in Firebase can result in unexpected behavior. See https://www.firebase.com/docs/web/guide/understanding-data.html#section-arrays-in-firebase for more information.
我廠
.factory('TEST', function ($firebaseArray) {
var ref = new Firebase('https://shark-firebase.firebaseio.com');
return {
all: function(section) {
var data = $firebaseArray(ref.child(section));
return data;
},
get: function(section, id) {
var data = $firebaseArray(ref.child(section).child(id));
return data;
}
};
});
我嘗試TOGETHER:
get: function(section, id) {
var data = $firebaseArray(ref.child(section));
return data.$getRecord(id);
}
和我的控制器:
萬一,$ stateParams.section = 'posts'和$ stateParams.id ='0'。
$scope.loadItem = function(){
$scope.item = TEST.get($stateParams.section, $stateParams.id);
};
Thx很多,我不嘗試混合數組和對象函數,thx再次! –