angularfire2

ReferenceError : XMLHttpRequest is not defined when running my angular 6 universal app

孤街醉人 提交于 2020-05-29 07:42:27
问题 I have made a Angular 6 project with dependency Angularfire2 . I am using firestore and firebase storage. I have converted my app to angular universal and when i run server.js it says listening on localhost:4000 but as soon as i open the browser with localhost:4200 the terminal shows the following error: ReferenceError: XMLHttpRequest is not defined here is the snippet of the error 回答1: Install these dependencies: npm install --save-dev ws xmlhttprequest Then add this to your server.ts file

Use FirebaseUI with AngularFire2

时光总嘲笑我的痴心妄想 提交于 2020-05-10 09:05:57
问题 I haven't found any samples. Is it possible to use the FirebaseUI with AngularFire2? AFAIK the UI is not part of AngularFire2. 回答1: There is indeed no direct integration between FirebaseUI (for the web) and AngularFire2. AngularFire2 has built in sign-in primitives that integrate with the lower-level sign-in functionality of the Firebase Authentication JavaScript SDK. For more about those, see the AngularFire2 documentation on user authentication. But given that both AngularFire2 and

Use FirebaseUI with AngularFire2

匆匆过客 提交于 2020-05-10 09:05:15
问题 I haven't found any samples. Is it possible to use the FirebaseUI with AngularFire2? AFAIK the UI is not part of AngularFire2. 回答1: There is indeed no direct integration between FirebaseUI (for the web) and AngularFire2. AngularFire2 has built in sign-in primitives that integrate with the lower-level sign-in functionality of the Firebase Authentication JavaScript SDK. For more about those, see the AngularFire2 documentation on user authentication. But given that both AngularFire2 and

Firestore transaction with multiple get

|▌冷眼眸甩不掉的悲伤 提交于 2020-05-10 07:33:27
问题 I'm trying to run a transaction with a variable number of read operations. I put the read () operations before than update (). Reading the Firestore doc on https://cloud.google.com/firestore/docs/manage-data/transactions "A transaction consists of any number of get() operations followed by any number of write operations such as set(), update(), or delete()" And When using transactions, note that: Read operations must come before write operations. A function calling a transaction (transaction

Infinit loop with firebase and angular

倾然丶 夕夏残阳落幕 提交于 2020-04-30 07:01:17
问题 I'm having an infinit loop problem saving my data on firebase with this.db.collection('users').doc(this.useruid).update({Info: this.currentInfo}) private currentInfo:string[]; private useruid: string; ... constructor(private AngularAuth: AngularFireAuth, private db:AngularFirestore) { } ... sendInfo(text:string){ this.useruid = this.AngularAuth.auth.currentUser.uid; this.db.collection('users').doc(this.useruid).snapshotChanges().subscribe(a=>{ const data = a.payload.data() as {name:string,

What is snapshotchanges in firestore

妖精的绣舞 提交于 2020-04-08 04:40:06
问题 this function is called by the constructor. can someone explain in depth to me what it does? initializeItems(){ this.travelList$ = this.plsdala.getTravelList() .snapshotChanges() .map( changes => { return changes.map(c=>({ key: c.payload.key, ...c.payload.val() })).slice().reverse(); //to reverse order }); } 回答1: It is current state of firestore collection. It returns an Observable of data. You would use it whenever you want to be able to get also your metadata as documentID as opposed to

Filter data from Firestore whit angularfire

Deadly 提交于 2020-03-03 04:26:11
问题 I'm trying to filter data from Firestore with Angularfire's Querying Collection: https://github.com/angular/angularfire2/blob/master/docs/firestore/querying-collections.md I'm a bit confused with the approach. I have managed to filter through a button but I do not know how to reset or remove that filter once done. What is the correct way to filter and reset said filter? Here I have a stackblitz: https://stackblitz.com/edit/query-collections-in-angularfire2 My code so far: service.ts filterBy(

AngularFire2 Authentication Error: First argument “email” must be a valid string

最后都变了- 提交于 2020-02-23 04:36:28
问题 I am trying to make login and signup forms for my web app using angularFire2 and Firebase. I am getting an error when taking a users signup information and passing it into the signInWithEmailAndPassword function. signInWithEmailAndPassword failed: First argument "email" must be a valid string. I have everything in my component that deals with the email variable typed as a string and it logs to the console as a string so I am not sure exactly what is going on. I have researched for almost 3

Filtering Observable with Rxjs

烂漫一生 提交于 2020-02-06 08:25:54
问题 I'm trying to get a list of active jobs for the current user: jobListRef$: Observable<Job[]>; ... this.afAuth.authState.take(1).subscribe(data => { if (data && data.uid) { this.jobListRef$ = this.database.list<Job>('job-list', query => { return query.orderByChild("state").equalTo("active"); }) .snapshotChanges().map(jobs => { return jobs.map(job => { const $key = job.payload.key; const data = { $key, ...job.payload.val() }; return data as Job; }); }) .filter(val => val.map(job => { return

Filtering Observable with Rxjs

寵の児 提交于 2020-02-06 08:25:48
问题 I'm trying to get a list of active jobs for the current user: jobListRef$: Observable<Job[]>; ... this.afAuth.authState.take(1).subscribe(data => { if (data && data.uid) { this.jobListRef$ = this.database.list<Job>('job-list', query => { return query.orderByChild("state").equalTo("active"); }) .snapshotChanges().map(jobs => { return jobs.map(job => { const $key = job.payload.key; const data = { $key, ...job.payload.val() }; return data as Job; }); }) .filter(val => val.map(job => { return