나는 angularfire2 문서를 읽으려고 시도했으며 여기까지 왔습니다. 내 인증 서비스 호출은 anglefire.auth.login입니다. 이 함수를 구독하고 반환 된 userinfo를 데이터베이스에 저장하려고합니다.사용자를 인증하고 세부 정보를 저장하는 방법
Error: Typescript found the following errors: /Users/macbook/dev/app/kichenclub/tmp/broccoli_type_script_compiler-input_base_path-nMnfGgj9.tmp/0/src/app/auth.service.ts (12, 25): Property 'displayName' does not exist on type 'FirebaseAuthState'.
모든 '나 displayName'에 대한 같은 :
타이프 라이터 컴파일러는 오류를 반환합니다.
나는 올바른 방향으로 가고 있습니까? 이것을 어떻게 해결할 수 있을까요?
authentication.service.ts : 어떤 추가 정보가 필요한 경우
import { Injectable } from '@angular/core';
import { AngularFire, AuthProviders, AuthMethods } from 'angularfire2';
@Injectable()
export class AuthService {
private userModel= this.af.database.object('/users');
constructor(private af: AngularFire) {
this.af.auth.subscribe((auth) => {
console.log(auth);
this.userModel.set({
uid: auth.uid,
firstName: auth.displayName.split(0, auth.displayName.lastIndexOf(' ')),
lastName: auth.displayName.split(auth.displayName.lastIndexOf(' '), auth.displayName.length),
displayPic: auth.photoURL,
provider:auth.provider
});
});
}
public loginFacebook(): void {
this.af.auth.login({
provider: AuthProviders.Facebook,
method: AuthMethods.Popup
})
}
}
이, 알려주세요.
마지막으로, 들러 주셔서 감사합니다. :)
@dan. 사실, 나는 로깅과 통과를 거쳤습니다. 사실, 나는'auth.auth'가 실제로 데이터를 가지고 있다는 것을 놓쳤습니다. 내 잘못이야. 나는 카페인이 너무 많아서 그 사실을 알지 못한다. :피 – ankitjain11