0
私はリストに自分のユーザーの名前のフロントエンドを表示しようとしています。フロントエンドにangle/anglefireのfirebaseからユーザー名をリストする方法は?
私はそのようなユーザーを作成しています:
ユーザーが魔法のように-working、データベース内だけでなく、Firebaseの認証に登録されているfirebase.initializeApp(config);
var app = angular
.module('app', ['firebase'])
app.factory("Auth", ["$firebaseAuth",
function($firebaseAuth) {
return $firebaseAuth();
}
]);
app.controller("SampleCtrl", ["$scope", "Auth",
function($scope, Auth) {
$scope.createUser = function() {
$scope.message = "One or more field is not correctly entered !";
$scope.error = null;
Auth.$createUserWithEmailAndPassword($scope.email, $scope.password, $scope.name)
.then(function(firebaseUser) {
$scope.message = "User created with uid: " + firebaseUser.uid;
const uid = firebaseUser.uid;
const dbref = firebase.database().ref().child('users').child(uid);
dbref.update({
email: $scope.email,
id: uid,
name: $scope.name
});
console.log(dbref.uid);
}).catch(function(error) {
$scope.error = error;
});
};
$scope.deleteUser = function() {
$scope.message = null;
$scope.error = null;
$scope.auth.$onAuthStateChanged(function(firebaseUser) {
$scope.firebaseUser = firebaseUser;
});
// Delete the currently signed-in user
Auth.$deleteUser().then(function() {
$scope.message = "User deleted";
}).catch(function(error) {
$scope.error = error;
});
};
}
]);
!フロントエンド内のすべてのユーザー名を呼び出すために
私は次のことを試してくださいました:
<ul><li ng-repeat='user in users'>{{users.name}}</li></ul>
任意の成功なし。
これを達成する方法を知っている人はいますか?私のコードで何が間違っていますか?
ありがとうございます!