本文介绍了收到错误:“没有导出的成员AngularFire,AuthProviders,AUthMethods,FirebaseListObservable".在AngularFire2中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Angular 4的新手,所以我要使用Angular 4创建一个Firebase聊天应用程序,然后在导入诸如以下这样的模块时:

I am new to Angular 4, so I am creating a firebase chat app with Angular 4, and then when I import some modules like this:

import { AngularFire, AuthProviders, AuthMethods,FirebaseListObservable } from 'angularfire2';

对于每个显示

谢谢

推荐答案

截止日期(版本5.0.0-rc3):

出现此错误时,这意味着您正在使用旧的数据库API.这可以通过从已取消模块导入FirebaseListObservable来解决(另请参见 @Ashish Jha 答案):

While getting this error, this means you are using old Database API. This can solved by importing FirebaseListObservable from depracated module(See also @Ashish Jha answer):

import { AngularFireModule } from 'angularfire2';
import { AngularFireDatabase, FirebaseListObservable, FirebaseObjectObservable } from 'angularfire2/database-deprecated';

由于AngularFire 5.0为实时数据库带来了新的API,因此建议使用最新的API.请参阅升级指南.

It's recommended to use the latest API since AngularFire 5.0 brings new API for the Realtime Database. Refer upgrade guide.

原始答案:自4.0.0+起,AngularFire2已将其模块分离.

ORIGINAL ANSWER:AngularFire2 has separate its modules since 4.0.0+.

如果您想使用angularfire2的身份验证,则可以导入这两个模块,请查看它们的更改日志:

you can import those two module if you want use auth of angularfire2, see their change log :

import {AngularFireModule} from 'angularfire2';
// for auth    
import {AngularFireAuthModule} from 'angularfire2/auth';
// for database
import {AngularFireDatabaseModule} from 'angularfire2/database';

并通过以下方式导入AuthObservable(可以在AngularFireAuth中找到AuthMethods)类型:

and import Auth and Observable(AuthMethods can be found in AngularFireAuth) type by:

// for auth
import { AngularFireAuth } from 'angularfire2/auth';
// for database
import { AngularFireDatabase } from 'angular2/database';
// for Observables
import {FirebaseListObservable, FirebaseObjectObservable } from 'angularfire2/database';

这篇关于收到错误:“没有导出的成员AngularFire,AuthProviders,AUthMethods,FirebaseListObservable".在AngularFire2中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-21 20:42