错误 TS2339:属性 'sendemailverification' 在类型 'UserCredential' 上不存在
error TS2339: Property 'sendemailverification' does not exist on type 'UserCredential'
我收到这个错误:
error TS2339: Property 'sendemailverification' does not exist on type 'UserCredential'
这是我的代码
我使用 firebase 电子邮件验证
import { Component, OnInit } from '@angular/core';
import {NgForm} from '@angular/forms';
import * as firebase from 'firebase/app';
@Component({
selector: 'app-sign-up',
templateUrl: './sign-up.component.html',
styleUrls: ['./sign-up.component.css']
})
export class SignUpComponent implements OnInit {
constructor() { }
ngOnInit() {
}
onSubmit(form: NgForm) {
const fullname = form.value.fullname;
const email = form.value.email;
const password = form.value.password;
firebase.auth().createUserWithEmailAndPassword(email, password)
.then(userData => {
//error
userData.sendemailverification();
console.log(userData);
})
.catch(err =>{
console.log(err);
});
}
}
正确的方法是sendEmailVerification
而不是sendemailverification
您可以使用 userData.user.sendEmailVerification()
使其工作。
我收到这个错误:
error TS2339: Property 'sendemailverification' does not exist on type 'UserCredential'
这是我的代码 我使用 firebase 电子邮件验证
import { Component, OnInit } from '@angular/core';
import {NgForm} from '@angular/forms';
import * as firebase from 'firebase/app';
@Component({
selector: 'app-sign-up',
templateUrl: './sign-up.component.html',
styleUrls: ['./sign-up.component.css']
})
export class SignUpComponent implements OnInit {
constructor() { }
ngOnInit() {
}
onSubmit(form: NgForm) {
const fullname = form.value.fullname;
const email = form.value.email;
const password = form.value.password;
firebase.auth().createUserWithEmailAndPassword(email, password)
.then(userData => {
//error
userData.sendemailverification();
console.log(userData);
})
.catch(err =>{
console.log(err);
});
}
}
正确的方法是sendEmailVerification
而不是sendemailverification
您可以使用 userData.user.sendEmailVerification()
使其工作。