Search Posts

Category: firebase

AngularJS & Firebase – Get specific values from database

Sorry to bother you with this, I have thoroughly searched for this but I have been actively trying to resolve this for over 20hrs. Im about to abandon working with angularjs and firebase. Just cant get my head around it.. I am trying to add database values to the page from an array. Its working for other data but not this. My firebase database: I have included the freebets related code which is all good […]

Firebase storage

I’m working on a project where i’m doing image processing in raspberry pi using python and then send an image to firebase storage and my task is to display that image on my web app (built in angular5). Till now i’m able to upload image to firebase storage through raspberry pi but i’m unable to retrieve image directly from storage to display in web app.Is there a way to do it ?if not then can […]

debug firebase messaging service worker for browser

I am trying to implement firebase push notification in angularjs(1.x) app, I am receiving notification except couple of issues in messaging.setBackgroundMessageHandler() and click handler. Is there any way that I can debug firebase-messaging-sw.js file? I am trying to put custom icon which is not working. Below is the code I have used: messaging.setBackgroundMessageHandler(function(payload) { var notificationOptions = { icon: ‘file:///C:/xampp/htdocs/client_xampp/client/images/my-logo.svg’ }; return self.registration.showNotification(notificationTitle, notificationOptions); }); After receiving background notification, when user click on notification I […]

Firebase database for survey results

I am trying to store my survey results data in the firebase database. I have structured it as the following: organization_id > survey_id > user_id > question_id : choice_id Example : 2:organization_id, 25: survey_id, 225: user_id, 101: question_id, 1/2/3/4/5: choice_id firebase database structure I want to show how many users selected a particular choice for a question. Expected result How can i do that using firebase javascript api’s ? Is there any better ways to […]

Query for sorting a date that is inside another object in firebase

I’m developing a chat in angularjs where I have a chat list view and a chat view. What I’m trying to do is sorting my chat list to show the most recent chat on top using Firebase and JS, I did my research but all of the questions I found they have the date directly as a child but inside my DB my date is inside a ‘lastMessage’ key. My dates are the following format. […]

Firebase $loaded() on $firebaseArray()

I am using AngularFire and promises on arrays ($loaded() on firebaseArray()). Currently, I’m using the following code: Problem: I go to page1, the data is loaded and all fine. Go to page 2 and come back to page1. Now the $loaded() doesn’t work until I do a full page refresh. How do I fix this problem? app.factory(‘Items’, [‘FBURL’, ‘$firebaseArray’, function(FBURL, $firebaseArray) { return { ofCategory: function(catId){ var ref = new Firebase(FBURL); var refSearch = new […]

save the data under the currentuser in the datafirebase

I create a web-page where users can log in and update their profiles, as you can see here but the button doesn’t work, it doesnt save the data in the current user in the firebase, like the about and userImg in this picture bellow is my code html: <form class=”Email-change”> <p class=”text-typ”>Email:</p> <input type=”email” ng-model=”” class=”line”> <p class=”text-typ”>Username:</p> <input type=”text” ng-model=”user.displayName”> <p class=”text-typ”>About:</p> <input type=”text” id=”aboutMsg” ng-model=”user.About”> <br> <button class=”change” id=”aboutSubmit” onclick=”updateAbout()”>Change information</button> </form> controller: […]

can’t get params from firebase function

I’m currently trying to send a confirmation email with sendgrid API from a firebase function. The API is not the problem though, it seems to work fine, my problem is that I can’t get the child oncreate’s value (Firebase function log): TypeError: Cannot read property ‘participant_id’ of undefined at exports.SendEmail.functions.database.ref.onCreate.event (/user_code/index.js:15:38) at Object.<anonymous> (/user_code/node_modules/firebase-functions/lib/cloud-functions.js:112:27) at next (native) at /user_code/node_modules/firebase-functions/lib/cloud-functions.js:28:71 at __awaiter (/user_code/node_modules/firebase-functions/lib/cloud-functions.js:24:12) at cloudFunction (/user_code/node_modules/firebase-functions/lib/cloud-functions.js:82:36) at /var/tmp/worker/worker.js:716:24 at process._tickDomainCallback (internal/process/next_tick.js:135:7) And here’s my code: const […]

Trouble with Upload Task Snapshot

I have a problem with displaying image on my project. I want in the .subscribe task the download url to equal as image. So it can display it. But when I do that it shows an error message: Type ‘UploadTaskSnapshot’ is not assignable to type ‘string’. Here is the code: export class PostDashboardComponent implements OnInit { title: string; image: string = null; content: string; buttonText: string = “Create Post”; uploadPercent: Observable<number>; downloadURL: Observable<string>; constructor( private […]

Set firebase messaging issue messaging/only-available-in-sw

I’m trying to set up firebase in my angularJS project to use background notification and in app notification. What I did: install firebase by npm install –save firebase add manifest.json with sender id to root directory put this scripts in <head>: <script src=”node_modules/firebase/firebase-app.js”></script> <script src=”node_modules/firebase/firebase-messaging.js”></script> Add this script just after <body> is open: <script> var config = { apiKey: “AIzaSyDAVuWKUL-aPoGasdEi-EMR7uFN1gtgk0s”, authDomain: “”, databaseURL: “”, projectId: “testproject-12d71”, storageBucket: “”, messagingSenderId: “123128116401” }; firebase.initializeApp(config); </script> Add this […]

Next Page »