Search Posts

Category: firebase-database

AngularJS and Firebase Uniqie Child ID

My Firebase DB is like on the Left Side of this picture and i wanted to make just like on the right side how do i do that? btw im still learning firebase and angularjs the problem is i dont know how to use the push key function in database and i can’t seem to find another way around it This is my current JS code for it. angular.module(“webApp.addCourse”,[‘ngRoute’,’firebase’]) .config([‘$routeProvider’,function($routeProvider){ $routeProvider .when(‘/addCourse’,{ templateUrl:”addCourse/addCourse.html”, controller:”AddCourseCtrl” }); […]

fetching table with child in firebase database gives many instances of same object

I have my API here: findById(id: string): Promise<any> { return this.db.list(‘/users’).$ref.orderByChild(‘id’).equalTo(id) .once(‘value’); } And its caller here: this.usersService.findById(value) .then(snap => { snap.forEach(e => { console.log(e.val()); }); }).catch(err => { console.log(err) }); In my database I have only 2 users (users the tables not the authenticated ones). When I run my app (my Angular 4 page) I see a lot of the same object logged: Here: My question is why is there so many instances of […]

Firebase Call to the dynamic Reference not giving proper output

i am creating a chat application for the browser using angular 1 and ionic 1 here is my controller and view for that the problem is when the new message comes in the selected room which is current room watch variable and below console giving me proper output but that same method getting called twice giving me proper output at fist call but after that he gives me main node output. $scope.firstLoad=”; $scope.directLoad=”; $scope.text = […]

Firebase & Angular: get the tournament with less than 16 subscribers

I am new to Firebase and currently working on a website. I want to access my Firebase database, more specifically the tournaments section with ‘knockout’ subsection. In this subsection I would like to find and return the tournament with a property ‘number’ of which the value is lower than 16. If there is one then I would like to add a new subscriber to that tournament. If there isn’t any, I would like to add […]

AngularFire update data without pulling already existed data value?

Hi is it possible to update data with adding a number to already existed data in db or pulling initial data then adding number to it is a must ? i mean: this.db.object(‘something’).update({ current:+1 // something like that current value is 0 in db. }); or i have to write like this.db.object(‘something’).update({ current:this.current+1 // i pulled current value before this is working of course }); Source: AngularJS

firebase.database(…).ref(…) limit is not a function during load the first 10 data from the firebase in AngularJs?

I have to get the first 10 data from firebase but i got error after load the page sir tell me how to fix this error? var PRODUCT_DB_REF = firebase.database().ref(‘datastore/productsCatalog’).limit(10); PRODUCT_DB_REF.child($scope.categoryKeyId).child(AUTH.userTypeKeyId).child(“catalogs”).on(“value”, function(snapshot){ } Source: AngularJS

Inserting encapsuled object in firestore and goods practices

I have a question about to insert object in firestore in angularfire: My object Person.ts name: String age: Number //–constructor– //–getters and setters– if I do this, insert ok: (BUT is this good practice?) [person.component.ts] this.db.collection(“person”).add({ name: this.person.$nome, age: this.person.$email }) … but if I try: [person.component.ts] this.db.collection(“person”).add({ Person: this.entrevistador //or this this.person }) I get this error in browser console: Function DocumentReference.set() called with invalid data. Unsupported field value: a custom Person object (found […]

How to return asyncronously return data from firebase to devextreme grid in angular 4

Good day, could you help me with the question? I’m trying to receive data from firebase to devextreme component. I’m using angular4. Here is the code of my html page: <dx-data-grid [dataSource]=”priorities”> <dxi-column dataField=”Priority”></dxi-column> </dx-data-grid> In the class of my component I receive the data from database this way: ngOnInit() { this.ds.list(‘priority’).valueChanges().subscribe( data => { console.dir(data) for(var k = 0; k<data.length; k++){ var prior = new priority(); prior.Prioritie = data[k].toString(); this.priorities.push(prior); } console.dir(this.priorities);} where priorities […]

Push firebase uid to multiple locations – Angularfire2 Ionic 3

I have the following which simply pushes a name into the database along with a uid. I would like to store that uid in another location at the same time. How can I achieve this? Im using ionic 3, angularfire2. addName() { let prompt = this.alertCtrl.create({ title: ‘Name of user’, message: “Enter a name for this new user”, inputs: [ { name: ‘Name’, placeholder: ‘Username’ }, ], buttons: [ { text: ‘Cancel’, handler: data => […]

Next Page »