angularfire2

Access parent documents field in Firestore rules

孤人 提交于 2019-12-09 04:46:23
问题 I'm implementing a recipe book in Firestore where every user is able to see all the recipes all users created but only the original author of the recipe is allowed to edit or delete the recipe. Any user is also allowed to create a new recipe. My problem is that I am unable to setup the permissions a subcollection to "listen" on a field of the subcollections parentdocument. Each recipe document contains three things. A field called name where the name of the recipe is stored, a field called

Using Firebase reauthenticate

吃可爱长大的小学妹 提交于 2019-12-08 15:24:39
问题 I'll appreciate assistance with how to reauthenticate a user in Firebase. I wonder if it makes any sense adding all these great features if the documentation doesn't explain how to use it: Currently, this is what I'm trying, and it ain't working. Errors as cannot read property 'credential' of undefined In constructor: constructor(@Inject(FirebaseApp) firebaseApp: any) { this.auth = firebaseApp.auth(); console.log(this.auth); } then the function changePassword(passwordData) { if(passwordData

Find object in Firebase by one value

允我心安 提交于 2019-12-08 11:35:06
问题 I have next database list (usernames + user id). How can i find object by user id and change his key (username)? I'm using AngularFire2 with Angular 5. 回答1: You can find a child node by its value with a query like this: var users = firebase.database().reference("usernames"); var query = users.orderByValue().equalTo("Sk6I..."ltA2"); By attaching a listener to this query you'll be able to find the reference and the key of the user (or "any users", since technically there may be more keys with

How to JOIN two nodes with AngularFire2 and Firebase?

天涯浪子 提交于 2019-12-08 11:35:02
问题 I have this structure of my Firebase Database Each library can have several albums. How can I display the albums for each library? the albumsPerLib: first element is the library key, and underneath each library key, I store the albums keys, that belong to it. But I'm not used to NoSQL and can't figure how to join the tables to display the albums for each library. 回答1: so this works: getAlbumsThatBelongToLib(libKey:string):Observable<Album[]>{ //get the keys for the lib albums const

Firebase 3 - Many-to-many relationships…can't quite get it

时光毁灭记忆、已成空白 提交于 2019-12-08 10:28:29
问题 I'm relatively new to Firebase, as well as the new Query API that comes along with it. Basically, I've got a data store setup where users can add videos from YouTube that they showcase on their profiles. Since users can have many videos and videos can have many users, I've attempted to construct my data store in the appropriate fashion, based on best practices, as shown here: { users { c25zdGFyb3NjaWFrQGdtYWlsLmNvbQ== videos { AFA-rOls8YA: true, AlLsp4gnyDQ: true, dX_1B0w7Hzc: true,

Get a single document by foreign key in using RxJs and AngularFirestore

有些话、适合烂在心里 提交于 2019-12-08 07:55:34
问题 I've written a query that looks like this: getPaymentByBookingId(id: string): Observable<Payment> { return this.afs.collection<Payment>('payments', ref => ref.where('bookingId', '==', id).limit(1)) .valueChanges() .pipe( flatMap(array => from(array)), first() ); } Where a Payment object has a unique reference to a Booking id. I want to find the Payment for a given ID. This seems like quite a convoluted way to right this query. Is there a simpler way to do this - including if there is a code

updateing .snapshotChanges() code to use angularfire2 5.0..0 rc-8, firebase 5.0.2

淺唱寂寞╮ 提交于 2019-12-08 06:11:22
问题 I have successful update angularfire 5.0.0.rc 8 and firebase 5.0.2 with no error module. I guess last thing i have to do is to change this code to retrieve all data import { Component } from '@angular/core'; import { NavController } from 'ionic-angular'; import { IonicPage } from 'ionic-angular/navigation/ionic-page'; import { Observable } from 'rxjs'; import 'rxjs/add/operator/map'; import { Note } from '../../model/note/note.model'; import { NoteListService } from '../../services/note-list

localhost:3000/traceur SystemJS with AngularFire

依然范特西╮ 提交于 2019-12-08 05:47:20
问题 I picked the getting started with Angular2 tutorial format and only added in the angularfire2 part. I installed firebase and angularfire2 using the steps on the angularfire2 docs page Below is my systemjs.config.js /** * System configuration for Angular 2 samples * Adjust as necessary for your application needs. */ (function (global) { System.config({ paths: { // paths serve as alias 'npm:': 'node_modules/' }, // map tells the System loader where to look for things map: { // our app is within

AngularFire2 Complex Query

给你一囗甜甜゛ 提交于 2019-12-08 05:33:32
问题 I need to query a Firebase list based on two keys and values. For example: books -gdhagd342363 status:'Active' authers -yruywert676:'john markos' -eiuqwbj8200:'mark solo' -jdfhs8797429 status:'Active' authers -yruywert676:'john markos' So I want to find how many books are (status=='Active') AND (the key of the authers child == -yruywert676 ). How to implement such query ? 来源: https://stackoverflow.com/questions/42260757/angularfire2-complex-query

Runtime Error this.object.remove is not a function

余生长醉 提交于 2019-12-08 05:23:31
In my Ionic app, I can't delete specific key, it keeps telling me that remove is not a function. It seems there are some things changed after the last updates in angularfire2 . It gives me this error: Runtime Error this.employees.remove is not a function TypeError: this.employees.remove is not a function at EmployeesPage.webpackJsonp.76.EmployeesPage.deleteEmployee (http://localhost:8100/build/main.js:319:24) at Object.eval [as handleEvent] (ng:///AppModule/EmployeesPage.ngfactory.js:47:31) at handleEvent (http://localhost:8100/build/vendor.js:12380:138) at callWithDebugContext (http:/