2016-07-07 1 views
5

AngularFire2로 비밀번호 재설정/비밀번호 찾기 기능을 구현하고 싶습니다. sendPasswordResetEmail 함수가 아직 AngularFire2에 의해 제공되지 않았거나 타이핑이 업데이트되지 않은 것처럼 보입니다. sendPasswordResetEmail이 AngularFireAuth의 일부이기 때문에, 나는 여전히 같은 기능에 액세스 할 수 있습니다 생각 :AngularFire 2 sendPasswordResetEmail

타이프 라이터 나에게이 오류 제공
(this.af.auth as any).sendPasswordResetEmail('email'). 
     then((result: any) => { 
      console.log('Result:', result); 
     }).catch((err: any) => { 
      console.log('Err:', err); 
     }); 

: 나는 새로운 오전부터

error TS2349: Cannot invoke an expression whose type lacks a call signature. 

가 타이프하는 + angular2, 힌트 방법을 sendPasswordResetEmail에 액세스 할 수 있습니까? 내 생각 엔 firebase에서 제공하는 순수 js SDK에 액세스해야하지만 그 방법은 모른다.

감사합니다.

+0

나는 정확히 같은 문제가 있습니다. 나는 이것이 아직까지 angularfire 2.0.0 beta.2라고 생각하지 않는다. –

답변

5

아래에서 볼 수 있듯이 구성 요소 생성자에 FirebaseApp을 삽입하면 AngularFire2 SDK의 기존 기능이지만 완전히 구현되지 않은 기능을 사용할 수 있습니다. 이것은 당신이 sendPasswordResetEmail 방법에 액세스 할 수 있습니다 : 당신이 지금 anyFirebaseApp의 인스턴스를 선언해야합니다

import { Component, Inject } from '@angular/core'; 
import { AngularFire, FirebaseApp } from 'angularfire2'; 

@Component({ 
    selector: 'app-forgot-password', 
    template: '...' 
}) 
export class ForgotPasswordComponent { 
    private auth: any; 
    constructor(private af : AngularFire, @Inject(FirebaseApp) fa : any) { 
    this.auth = fa.auth(); 
    } 

    onSubmit() { 
    this.auth.sendPasswordResetEmail(this.user.email) 
     .then(resp => console.log('sent!')) 
     .catch(error => console.log('failed to send', error)); 
    } 
} 

알 수 있습니다.

+0

참고로, 주입 된 앱을'firebase.app.App'로 선언 할 수 있습니다 - [this] (http://stackoverflow.com/a/39069813/6680611) 답변을 참조하십시오. – cartant

+0

좋은 @ 카르탄! 감사. –