angularfire

AngularFire error only when ng serve --prod

感情迁移 提交于 2019-12-23 07:09:41
问题 I have an Angular 8 app, using npm package Angular Firebase ( https://github.com/angular/angularfire2 ) and when I build the app with the Angular CLI command ng build --prod and deploy to my hosting I get the following Chrome Browser Console error: TypeError: Object(...)(...).auth is not a function If I instead build with the command ng build --prod --optimization=false the error does not occur. Something with Angular CLI ng build option optimization set to true is causing the AngularFire2

AngularFire: How to filter a synchronized array?

与世无争的帅哥 提交于 2019-12-23 05:29:28
问题 Consider a set of items and users. Each user can have one or more items. The set of items can be quite big, but every user will normally have small amount of items. app: items: item1: name: 'table' color: 'white' createdAt: '2014-08-09T12:54:58.803Z' item2: name: 'macbook air' color: 'silver' createdAt: '2014-06-09T12:54:58.803Z' item3: name: 'firebase t-shirt' color: 'yellow' createdAt: '2014-07-09T12:54:58.803Z' users: user1: items: item1: true item3: true user2: items: item2: true Given a

How to append a new value to an item within an array in Firebase?

我是研究僧i 提交于 2019-12-23 04:58:12
问题 Within Firebase, I have a list of 'ideas.' If a user presses a button associated with the idea, I'd like a value to be appended to that idea under an attribute called 'newValue.' For example, the below html, uses ng-repeat to show the array of ideas and creates an associated button called 'Append Value.' I want a new value to be appended to the idea's attribute called 'newValue' every time a user presses 'Append Value.' <body ng-controller="ctrl"> <table> <tr class="item" ng-repeat="(id,item)

remove just a item by angularfire

对着背影说爱祢 提交于 2019-12-23 04:54:28
问题 I just want to remove an item, but my code removes all the items. I don't understand and can't find another solution, please help <div ng-repeat="(id, data) in datas"> <input type="text" ng-model="data.name" ng-change="datas.$save(data)" /> <input type="text" ng-model="data.age" ng-change="datas.$save(data)" /> <a ng-click="removeItem(id)">delete</a> </div> ref = new Firebase(FIREBASE_URL); authData = ref.getAuth(); obj = $firebaseObject(ref); obj.$remove(id); 回答1: If FIREBASE_URL points to

How to apply rxjs operator to data got from angularfire2

我怕爱的太早我们不能终老 提交于 2019-12-23 04:21:17
问题 Suppose I requested for data in angularfire2 like this: var ref = new Firebase("firebase url"); Now how can I apply rxjs operator like map operator to the data coming 回答1: I don't think you are looking at angularfire2 there - that's v1 code... You can use the rxjs operators in angularfire2 - the data is returned as an Observable (FirebaseListObservable or FirebaseObjectObservable) - so you can import and apply any of the rxjs operators to those... In general, you just assign the data to a

How to get properties / values from snapshot.val() or snapshot.exportVal() in Firebase?

旧时模样 提交于 2019-12-23 03:55:12
问题 I was able to fetch my interested object as snapshot as shown in this CodePen Following is the code snippet : $scope.post = {}; var postsRef = new Firebase('https://docs-examples.firebaseio.com/web/saving-data/fireblog/posts'); $scope.searchPost = function () { console.log('searched for author : ' + $scope.post.authorName); postsRef.orderByChild('author') .equalTo($scope.post.authorName) .once('value', function (snapshot) { var val = snapshot.val(); console.log("Searched Post is : "); console

createUser and login flow with promises

情到浓时终转凉″ 提交于 2019-12-23 03:48:08
问题 In this git issue AngularFire disabled the auto-login functionality associated with $createUser . (The docs are outdated.) So what's the best practice / cleanest way to create a user and then log them in? app.factory('Auth', function($firebaseSimpleLogin, FIREBASE_URL, $rootScope) { var ref = new Firebase(FIREBASE_URL); var auth = $firebaseSimpleLogin(ref); var Auth = { register: function (user) { return auth.$createUser(user.email, user.password); }, login: function (user) { return auth.

Firebase: How do I retrieve records from my data for which a specific key exists?

笑着哭i 提交于 2019-12-21 17:19:03
问题 I have data in firebase that looks like this: "application": { "companies": { "firebase": { "creation": { "name": "Firebase Inc", "location": "USA" }, "google": { "creattion": { "name": "Google Inc", "location": "USA" } } "facebook": { }, "apple": { } } } } There are tens of thousands of records under companies key. How do i efficiently execute following queries? How do I query only the records for which key creation is present under their name? How do I query only the records that DO NOT

AngularFire2 firestore take(1) on doc valueChanges

大憨熊 提交于 2019-12-21 05:14:15
问题 Using AngularFire2 I try to get data from a single Firestore document. What works is : this.addressRef = afs.doc<Address>('addresses/key') this.addressRef.valueChanges().subscribe(val => {......} I want to run the subscription code just once. Normally I use take(1) to achieve this (works with the Firebase DB). But this code : this.addressRef.valueChanges().take(1).subscribe(val => {......} gives error : TypeError: this.addressRef.valueChanges(...).take is not a function. VS Code is listing

Delete Firebase anonymous users after a while

房东的猫 提交于 2019-12-21 03:43:07
问题 I am using anonymous auth to allow my users to use the app without logging in. However, Firebase seems to persist these anonymous user IDs indefinitely. Is there a way to automatically purge these or set some sort of expiration rule? I don't want these one-time use IDs to live forever and clutter the actual user data from providers. 回答1: Unfortunately this is a "memory leak" (user leak?) Since there is no reasonable way to force an anonymous user to convert, these anonymous user ids will soon