데이터베이스에 새 사용자를 추가 :는 Angularfire2 내가 다음 로그인 방법을 사용
login() {
this.auth.login();
this.authService.login().subscribe(() => {
if (this.authService.isLoggedIn) {
console.log("ADDING THE USER..");
// Add a new user to the users table
this.af.child("users").child(this.authService.userData.uid).set({
provider: this.authService.userData.provider,
name: this.getName(this.authService.userData)
});
// Redirect the user
this.router.navigate(['/panel']);
}
});
}
을 설명서의 방법과 거의 동일 어느 : https://www.firebase.com/docs/web/guide/user-auth.html#section-storing
내 응용 프로그램을 실행 다음 오류가 발생합니다.
Property 'child' does not exist on type 'AngularFire'.
사용자가 추가되지 않았습니다. 뭐가 문제 야?
필자가 필요로하는 것은 Firebase 데이터베이스에 새로운 개체를 추가하는 것입니다. 작품을 다음하지만 위와 같이 나는 구조를 필요
그래서this.users = this.af.database.list('/users');
this.users.push("TEST");
, 내가 https://www.firebase.com/docs/web/guide/user-auth.html#section-storing에서 동일한 구조를 사용하여 내 데이터베이스에 새 사용자 개체를 추가 할 수 있습니까? 문서화 된 코드와 동일한 코드를 실행할 수없는 이유는 무엇입니까?
업데이트
내 새로운 코드 :
this.af.database.object('/users/${this.authService.userData.uid}').set({
provider: this.authService.userData.provider,
name: this.getName(this.authService.userData)
});
없음 사용자가 삽입되지
- (내 중포 기지 데이터베이스가 비어)
https://github.com/angular/angularfire2/blob/master/docs/2-retrieving-data-as-objects.md#api-summary – cartant