我真的不明白我在这里做错了什么。所以我正在做的是尝试获取图片中描述的特定用户的帖子值
为了获得用户帖子,我使用了这个:
app.controller('chatController', ["$scope", 'AuthService', "Auth", "Ref", "$rootScope","$firebaseArray",
function($scope, AuthService, Auth, Ref, $rootScope, $firebaseArray) {
console.log(AuthService.User.email)//Gives me correct Email
console.log(AuthService.User.password)//Gives me correct password
console.log(AuthService.User.uid)//Gives me correct uid
console.log(AuthService.User.username)//Gives me correct username
var some = $firebaseArray(Ref.child("Posts").child(AuthService.User.username)); //Why Giving me an error here when i put that child in?
console.log((some))
var postsFirebase = $firebaseArray(Ref)
$scope.messages = postsFirebase
$scope.submit = function() {
if (!($scope.textValue)) {
//Checking for empty string
} else {
alert($scope.textValue)
Ref.child("Posts").child(AuthService.User.username).push({
"Posts": $scope.textValue
})
}
}
}
])
当我把孩子放在AuthService.User.username的第9行时,它给我一个错误说:
错误:Firebase.child失败:第一个参数是无效路径:" null"。路径必须是非空字符串,并且不能包含"。","#"," $"," [& #34;,或"]"
我的主要问题是从孩子那里获取数据。三江源 请帮我。三江源!