jjzjj

angularfire2

全部标签

javascript - AngularFire 单个对象

在angularFire示例中,它展示了如何从firebase获取对象集合。app.controller('ctrl',['$scope','$timeout','angularFireCollection',function($scope,$timeout,angularFireCollection){varurl='https://ex.firebaseio.com/stuff';$scope.col=angularFireCollection(url);}]);只有一个对象怎么样?我试过这样的:fb.child('stuff/'+id).on('value',function(s

javascript - 连接扁平数据

我想将init上的数据从我的客户表加入到项目列表中。模型是这样的:项目key名称:字符串客户:客户key客户key姓名:字符串你有例子吗,我如何使用angularfire2从angular2组件做到这一点?我的Controller看起来像这样:import{Component,OnInit}from'@angular/core';import{Project}from'../project';import{Router}from'@angular/router';import{FirebaseAuth}from'angularfire2';import{AngularFire,Fire

javascript - 使用 Firebase 重新验证

如果您能帮助我在Firebase中重新验证用户身份,我将不胜感激。我想知道如果文档没有解释如何使用它,添加所有这些强大的功能是否有意义:目前,这就是我正在尝试的方法,但它不起作用。错误为cannotreadproperty'credential'ofundefined在构造函数中:constructor(@Inject(FirebaseApp)firebaseApp:any){this.auth=firebaseApp.auth();console.log(this.auth);}然后是函数changePassword(passwordData){if(passwordData.val

javascript - 将对象添加到 Firebase 时设置自己的 key - AngularFire

我可以使用以下方法将对象添加到我的Firebase数据存储区:varuniqueId={name:"aname",location:"newyork"}$scope.myItems.$add(uniqueId).then(function(firebaseId){//dosomethingonsuccess},function(){//dosomethingifcallfails});上面的代码会将一个对象添加到我的数据存储中,如果添加成功,将返回一个由Firebase生成的ID。我刚刚添加的对象保存在这个键下。有没有办法让我在添加到我的数据存储时指定键名是什么?

无法处理$ statechange中的错误,使用ui-router和angularfire

我使用Google的应用程序中包括身份验证Firebase。我一直在关注他们的文档https://www.firebase.com/docs/web/libraries/angular/guide/user-auth.html。尽管此方法使用stateChange据我了解,这已被贬低ui-router。因此,在线查看我从此示例中转了我的脚本:app.run(["$rootScope","$state",function($rootScope,$state){$rootScope.$on("$stateChangeError",function(event,toState,toParams,fr

如何在按父键查询时获取子元素,AngularFire2

我正在学习Firebase+AngularFire2。我在firebase中的DB就像。我试图让课程的孩子>ncjkdhjjd8ejd。通过使用letll=(_angularFire.list("courses/ncjkdhjjd8ejd"));ll.subscribe((val)=>console.log(val))我正进入(状态:我如何在单个JSON对象中获得它,而不是3个数组。我只需要JSON结构中的值。看答案使用AngularFire2object可观察反而:letcourse=_angularFire.object("courses/ncjkdhjjd8ejd");course

错误更新AngularFire2对象

我正在使用AngularFire2检索firebase对象://AuthServicepublicgetUserID():Observable{returnthis.afAuth.authState.map(user=>user?user.uid:null)}//AccountServiceprivateprofileInfo:FirebaseObjectObservableconstructor(privatedb:AngularFireDatabase,privateauthService:AuthService){this.profileInfo=authService.getUserI

AngularFire2可观察到NGRX效应的返回

我有一个由Angular4,NGRX和AngularFire2构建的项目。我正在尝试检索当前登录的用户的UID,并将其放入我的商店中。任何想法或协助都将不胜感激。错误ERRORTypeError:Cannotreadproperty'map'ofundefinedatSwitchMapSubscriber.project(auth.effects.ts:22)效果代码@Effect()getAccountId$=this.actions$.ofType(ActionTypes.GET_ACCOUNT_ID).map(action=>//Thisisline22wheretheerrorisco

javascript - Firestore 获取数据时性能缓慢的问题

与1/10比率的实时数据库相比,我在检索存储在文档中的基本数据时遇到了Firestore性能缓慢的问题。使用Firestore,第一次调用平均耗时3000毫秒this.db.collection(‘testCol’).doc(‘testDoc’).valueChanges().forEach((data)=>{console.log(data);//3000mslater});使用实时数据库,第一次调用平均耗时300msthis.db.database.ref(‘/test’).once(‘value’).then(data=>{console.log(data);//300mslat

javascript - Firestore 获取数据时性能缓慢的问题

与1/10比率的实时数据库相比,我在检索存储在文档中的基本数据时遇到了Firestore性能缓慢的问题。使用Firestore,第一次调用平均耗时3000毫秒this.db.collection(‘testCol’).doc(‘testDoc’).valueChanges().forEach((data)=>{console.log(data);//3000mslater});使用实时数据库,第一次调用平均耗时300msthis.db.database.ref(‘/test’).once(‘value’).then(data=>{console.log(data);//300mslat