私はangularfire2文書を読んでみましたが、ここまで来ました。私の認証サービスコールは、anglefire.auth.loginです。この関数を購読し、返されたuserinfoをデータベースに保存します。すべての 'のdisplayName' のユーザーを認証してその詳細を保存する方法
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'.
と同じ:
活字体、コンパイラはエラーを返します。
私は正しい方向にいるのでしょうか?これをどうやって解決するか。
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'が実際にデータを保持していないことを忘れていました。私の悪い。私はカフェインが高く、それを見逃していたと思う。 :p – ankitjain11