问题描述
我的Web应用程序使用Firebase JS + AngularFire在应用程序中显示用户报告(仅对管理员可见).如何使用AngularFire检索用户的电子邮件地址?
My web application uses Firebase JS + AngularFire to display a report of users in the application (visible only to admins). How can I retrieve a user's email address using AngularFire?
查看AngularFire API参考,在$firebaseAuth
部分中没有看到可用的方法: https://github.com/firebase/angularfire/blob/master/docs/reference.md
Looking at the AngularFire API Reference, I don't see an available method for doing this in the $firebaseAuth
section: https://github.com/firebase/angularfire/blob/master/docs/reference.md
推荐答案
除非您进入firebase控制台并进行手动检查,否则您将无法轻松访问它.在firebase中,建议您在数据库中创建另一个名为用户"的节点,以用于存储用户"信息.这将帮助您在需要时轻松获取信息.
You can't easily access that unless you go to the firebase console and do a manual check.In firebase it is advised that you create another node called Users in your database to be used in storing Users info. This will help you to easily get the info when you need them.
检查我的示例代码,了解如何创建新用户.
Check my sample code on how to create a new user.
signUp() {
if (this.signupForm.valid) {
//grab login form values
let email = this.signupForm.get('email').value;
let password = this.signupForm.get('password').value;
let confirmpassword = this.signupForm.get('confirmpassword').value;
let petname = this.signupForm.get('petname').value;
let full_name = this.signupForm.get('full_name').value;
let address = this.signupForm.get('address').value;
let phone = this.signupForm.get('phone').value;
let default_role = this.signupForm.get('default_role').value;
//signup new user
this.security.signup(email, password).then((response) => {
//userid
let userid = response.auth.uid;
//create a new user using form values
let newUser: User = {
full_name: full_name,
password: password,
petname: petname,
email: email,
phone: phone,
default_role: default_role,
usercode: newusercode
};
//add new user to database table section
this.af.database.object("/Users/" + userid).set(newUser).then(() => {
//prepare userinfo for cache
let userInfo = {
uid: userid,
petname: petname,
default_role: default_role
}
});
}
这篇关于使用AngularFire获取用户电子邮件地址列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!