typescript - 离子 - Firebase 身份验证错误
问题描述
这是我的 register-form.component.ts 文件。
import { Component } from '@angular/core';
import { AngularFireAuth } from 'angularfire2/auth';
import { ToastController } from 'ionic-angular';
import { Account } from '../../models/accounts/account.interface';
@Component({
selector: 'app-register-form',
templateUrl: 'register-form.component.html'
})
export class RegisterFormComponent {
account = {} as Account;
constructor(private afAuth: AngularFireAuth, private toast: ToastController) {
}
async register() {
try{
const result = await this.afAuth.auth.createUserWithEmailAndPassword(this.account.email, this.account.password);
this.toast.create({
message: "Account succesfully created!!",
duration: 3000
}).present();
console.log(result);
} catch(e){
console.error(e);
this.toast.create({
message: e.message,
duration: 3000
}).present();
}
}
}
当我尝试通过构造函数传递 AngularFireAuth 变量时,它会显示此运行时错误。
错误:未捕获(承诺):TypeError: WEBPACK_IMPORTED_MODULE_1_firebase_app .app 不是函数 TypeError:WEBPACK_IMPORTED_MODULE_1_firebase_app .app 不是函数
我是离子新手。请帮我解决这个错误。
解决方案
先尝试 webpack 模块。做那个运行
npm 删除 webpack -g
然后再次安装 webpack
npm i webpack --save-dev
推荐阅读
- python - 如何检查sqlite python中的表是否已更改?
- c++ - 当我有一个与当前类中使用的值相同的枚举时,如何使用另一个类的枚举?C++
- html - 如何使用css为所有换行符添加全宽边框底部?
- c# - 自动将 LocalDate 转换为字符串 CassandraDriver
- c# - 如何使用谓词构建器返回满足特定搜索条件的活跃用户?
- amazon-web-services - AWS SageMaker 上的 ML Pipeline:如何创建长时间运行的查询/预处理任务
- python - 使用python自动登录网站形成一个txt,然后删除txt的第一行
- javascript - 传单:编辑模式下的 showArea
- php - InvalidArgumentException - 未定义提示路径
- c++ - 在 C++ 中,三角形区域是否显示为零???为什么?