FAQ Database Discussion Community

## See if number is in Firebase

javascript,jquery,angularjs,firebase,angularfire
So I have a form that registers users, <form class="" ng-submit="vm.passwordRegister()"> <div class="panel panel-default"> <div class="panel-heading"> Register </div> <div class="panel-body"> <div class="form-group"> <input type="text" ng-model="vm.number" class="form-control" placeholder="Client Number" ng-Blur="vm.numberCheck()"/> </div> <div class="form-group"> <input type="text" ng-model="vm.name" class="form-control" placeholder="Your Name" /> </div> <div...

## Get contents of child_added while watching firebaseArray

angularjs,firebase,angularfire,watch
I have a simple private chat, but with different type of messages, so when i send to server json structure I pass message type too. $scope.messages = fireChat.firebaseArray;$scope.addMessage = function(e) { //ADD TO FIREBASE $scope.messages.$add({ uid: $scope.authData.uid, text:$scope.msg, timestamp: Firebase.ServerValue.TIMESTAMP, type: 'msg' }); $scope.msg = ""; //RESET MESSAGE... ## Search inside objects javascript javascript,object,firebase I'm experimenting on login with firebase. I can make an account, and it'll store additional information too. The problem is retrieving this information. I can get it using: usersRef.on("value", function(snapshot) { console.log(snapshot.val()) }, function (errorObject) {...}); When I do this I get two things (because I have two accounts): -JrrzEOqZQU0HVeYVXCm:... ## How to loop through$firebaseArray

angularjs,firebase,angularfire

## Read data from Firebase and hide a class

jquery,firebase
I have a Firebase database with users in it with the following data: name: Some Name email: [email protected] tier: standard or premium I'd like to hide the class ".premium-feature" when the the Firebase data for 'tier' reads standard. If the data for 'tier' reads as anything else, I'll need to...

## Angular load additional data in ng-repeat

angularjs,firebase
I have an ng-repeat that has a bunch of ids and loops over them. I then want to load the data from an external source. So let's say I have an array [1,2,3,4,5] And I have an ng-repeat that loops over then shows <div>1</div> <div>2</div> ... I want to load...

## Cross-platform text, image, video Chat for Android, iOS and Web using Firebase/Parse/PubNub

android,ios,parse.com,firebase,pubnub
I want to develop a cross platform chat application which I can use to send text,url,image,location,video to my friends which can be on android/ios/web. I want chat to be realtime, and want to make sure that even if user is not using application, he get a 'Notification' for new incoming...

## Firebase Transaction [Error: Set]

node.js,firebase
I'm using firebase for node, and when attempting to use transaction to create store data, I get: [Error: Set] I'm having a hard time figuring out what this error code is suggesting. I've re-written my code, temporarily disabled security rules, but I get the same error. Here's the code I'm...

## Display Length of Array in Firebase

firebase,ionic-framework,ionic,angularfire
Just starting out with Ionic + Firebase and need help. After getting length of array, I want to display its number. Basically trying to get box on screen that constantly shows how many current people are in specific chat room as people move in and out. Got code below from...

## How can I securely store and retrieve API Keys for an android application (written in native Java) using Firebase Hosting?

firebase,api-key,firebase-hosting
I'm just starting to learn to code. Providing example code would be fantastic. I developed a simple android application (native Java) using Firebase. I have several API keys hard-coded into the resources of my application. I read that it is better to store these keys on a server. I currently...

## FireBase rule newData with uid

firebase,firebase-security
How can i to use unique id of new data in rule with newData? Data structure: I want to disallow to write for the users which one senderName is in ban_users, but i cannot to get the newData senderName: newData('senderName').val(); //not working newData('$message_id/senderName').val(); //also not working("$message_id": {}) ...

## How to use Firebase Twitter Authentication with React Native?

How to use Firebase Twitter Authentication with React Native? I tried both of the code below in reference to https://www.firebase.com/docs/web/guide/login/twitter.html var Firebase = require("firebase"); var App = React.createClass({ render: function() { return ( <View> <Text onPress={this._handlePress}> Twitter login </Text> </View> ); }, _handlePress: function () { var myApp = new...

## Firebase: when onDisconnect event fire?

android,firebase,firebase-android
I`m using Firebase-backend for my android applicaion. I'd like to build a users presence system for my chat. For this purpose I've taken the pattern from Firebase Guide final Firebase myConnectionsRef = new Firebase("https://<YOUR-FIREBASE-APP>.firebaseio.com/users/joe/connections"); // stores the timestamp of my last disconnect (the last time I was seen online) final...

## Joining data between paths based on id using AngularFire

angularjs,firebase
I am currently working on an app using firebase and angularJS (ionic). Basically this is a car management app, so you have people sharing their cars with others. I tried to structure the data as flat as possible to be efficient. My issue here is that if without problem I...

## Firebase data structuring - accessing jobIDs for each user

javascript,database,database-design,firebase
In my database, I currently have two kinds of objects, users and jobs. I am already storing userIDs in jobs. Do I also need to store jobIDs in each user? A typical user: "-JqzUjcOfddBNd_HtjKb" : { "contact" : { "-JqzWcIyD77ZwatEKALp" : { "email" : "[email protected]" }, "-JqzWrtyni3ZGOKooNF7" : { "email"...

## Authentication error “Access Denied” in AngularFire when using Internet Explorer 9

firebase,firebase-security
I'm using Firebase for simple email/password authentication. Logging in (using the AngularFire client) works fine on both Firefox and Chrome, but on IE9 I get an "Access Denied" error. At this point I have no security rules established, so by default all requests should go through. I've tried loosening the...

## handle asynchronous behavior firebase in angularjs

angularjs,firebase,promise
I'm trying put the authentication of my firebase in a service. But I stumbled on some problems with program flow. The response from firebase is slower and the code needs to wait for it to complete. I tried to create a promise, but it doesnt work properly. Here is my...

## Android Firebase, simply get one child object's data

android,firebase,firebase-database
I have been looking for a way to get one child object's data in Android Firebase. I have found things like Firebase retrieve child Android. All the solutions are suggesting using a "ChildEventListener", however I need to get this data at this moment, not when it is moved, deleted, updated,...

## firebase-import timing out?

json,node.js,firebase
I'm using the firebase-import tool to upload JSON data to my firebase. I consistently get the following error after trying to upload a JSON file that is ~40MB in size. Any ideas why? The output seems to be intentionally cryptic. It always happens when the upload is 42% complete, and...

## run jQuery click only after page loads

jquery,click,firebase
I have a page that is pulling content in from firebase and appending it to the page: code: function displaySavedData(Name, Company, Email, Phone, snap) { $('.data').append('<div class="each-container" data-del="'+snap+'"><div class="del">X</div><div class="row-margin"><div class="new-row-one">'+'Name: '+Name+'<br>'+'Company: '+Company+'<br>'+'Email: '+Email+'<br>'+'Phone: '+Phone+'</div></div></div>'); }; There is a div in there, for each div is added to the page... ## AngularJS: Uncaught ReferenceError:$rootScope is not defined in run

javascript,angularjs,firebase,angularjs-service,angularfire
I am trying to route all unauthorized traffic to the login page, and am using angularfire to authenticate. Here's all the relevant code. I know most of it is broken, but I'd like to get past this first. The problematic code is: App.js app.run(['$rootScope', '$location', 'AuthenticatorService', function ($rootScope,$location, AuthenticatorService)...

## Understanding Firebase's rules for user-write, global-read

firebase,angularfire,firebase-security,firebase-authentication
I am building a simple Firebase application with AngularJS. This app authenticates users through Google. Each user has a list of books. Anyone can see books, even if they are not authenticated. Only the creator of a book can edit it. However, individual users need to be able to record...

## Unlink listener for parent does it applied to children in Firebase

javascript,firebase
I am using firebase to synch data in a real time app. After some treatment, I want to unlink all listeners added. So I put myRef.off(); But I discover that some listeners are still attached. My question is: when you put listeners to off for a parent node does it...

## Basic understanding of Firebase security

javascript,firebase,firebase-security
Fundamentally, if my client side javascript is going to be modifying my Firebase data remotely, couldn't anyone come along and examine that code and start modifying the same Firebase data at will? I know they can't modify areas of the data that are off limits to various users or situations,...

## snap.ref.remove() is removing all the nodes in the parent rather than just itself

firebase
I was just trying to remove the top 2 nodes, but it removes the entire branch instead. If I comment out the remove(), it correctly console.logs the top 2 nodes, but when i uncomment the remove() it deletes all the nodes in that messagesRef, not just the top 2. messagesRef.limitToFirst(2).on('child_added',...

## Rendering TeX from something out of a database?

javascript,html,firebase,mathjax
I'm using Firebase to put stuff onto a website. Something like "get a multiple choice question/options and shove them into div tags". Some of these questions use math/chemistry equations, and I think TeX would be a great tool to render. Basically if my question is "Which reaction is exothermic?", I...

## Firebase data structure with cyclic dependency

android,database-design,structure,firebase
I'm currently discovering Firebase and trying to evaluate it for further projects. At the moment, i'm testing with a very simple "Todo list" app where lists can be shared with friends. I've read the Doc about flattening data structure to avoid complexity and I came up with the following structure:...

## AngularJS share function/common code in a controller

javascript,angularjs,firebase
I have a subroutine I want to use in my controller. In the case or working with data, a new record blanks fields, as would a screen clear, and after some other processes, I would like to clear the editable fields on the view. Controller: angular.module('MyApp').controller('Ctrl', ["$scope", "ServiceData", function ($scope,...

## Getting a certain row in Firebase

javascript,firebase
This is the code I got of the Firebase documentation. It returns everything inside the table, so in this case Object { first: "Fred", last: "Flintstone"} But I only need it to return the value of first, which is "Fred". var dbFirebase = new Firebase("firebaselink") dbFirebase.once('value', function(nameSnapshot) { var val...

## Can't log in/out or register, and my submitPost function stopped working

angularjs,firebase
Grunt gives me no errors and under the debugger "Error: [$injector:unpr] Unknown provider: AuthProvider <- Auth <- user <- NavCtrl and "Error: [$injector:unpr] Unknown provider: AuthProvider <- Auth <- user This is the auth service https://github.com/Eibonic/AngularJS-reddit/blob/master/app/scripts/services/Auth.js and this is the nav controller 'use strict'; app.controller('NavCtrl', function ($scope,$location, Post, Auth){...

## Firebase Qeue and Stripe Subscriptions

firebase,stripe-payments
I have read the other tutorials on how to integrate Stripe with Firebase, all of them require an external server. Recently I found Firebase Qeue and wondered if there would be any way to integrate Firebase Qeue with a Stripe Subscription so that I wouldn't need to use an external...

## Storing dictionaries into Firebase?

ios,swift,firebase,nsdictionary
I have a Firebase instance where I want to store a dictionary of values I want to store into firebase. I have looked on the documentation https://www.firebase.com/docs/ios/guide/saving-data.html as a reference but can't seem to get it to work. The following is my attempt: //Declared above are the currentUser values as...

## How to see if given object matches one of the objects returned from firebase

javascript,object,firebase
I am trying to test if the given object matches the stored objects that are stored and returned from firebase. If it does then return true or store true in a variable. Here is the example of given object and firebase returned data given object: {name: "John", age: "32"} stored...

## Firebase Authentication Limits

I am new to Firebase so any insights appreciated. I'm writing Java server side test code. I grab several users from an database and am trying to migrate the data into user authenticated nodes within Firebase. My code selects a few users from the DB and spins up a new...

## Cache without 'on' subscription

javascript,firebase
Is it possible to tell firebase to cache a path without having a 'on' subscription? Currently I'm doing the following which is both inefficient, space waste and ugly: const ref = new Firebase(someUrl) app.get('slow/:id', (req, res) => { ref.child(id).on('value', snapshot => res.send(snapshot.val())) }) const cache = {} ref.on('child_added', snapshot =>...

## Get only new “child added” after page load

javascript,firebase
I have on a website facebook style notification in top right corner. I show there up to 5 latest notifications. I do initial pulling with child_added and also after same firebaseRef child_added listening for new notifications. Now I'd like to play a sound on new notification and a little number...

## How to write denormalized data in Firebase

javascript,database,web,firebase
I've read the Firebase docs on Stucturing Data. Data storage is cheap, but the user's time is not. We should optimize for get operations, and write in multiple places. So then I might store a list node and a list-index node, with some duplicated data between the two, at very...

## Where to put Firebase.setAndroidContext() function

android,firebase,firebase-android
I'm trying to play a bit with Firebase and Android. I have one RegisterActivity, and one MainActivity. My current flow is - start with MainActivity - check if user is registered, if not, call RegisterActivity - after registeration call MainActivity. I'm having trouble with where to put the Firebase.setAndroidContext() call....

## orderByChild(), limitTo() not working in my angularjs project.?

angularjs,node.js,firebase,angularfire
I wanted to implement "Querying Data with firebase" whose documentation was given at fallowing link: "https://www.firebase.com/docs/web/guide/retrieving-data.html". I started implementing the code as following: getDetail : function() { var ref = new Firebase("https://dinosaur-facts.firebaseio.com/dinosaurs"); ref.orderByChild("height").on("child_added", function(snapshot) { console.log(snapshot.key() + " was " + snapshot.val().height + " meters tall"); }) }, But, I...

## FirebaseAuth Memory Leak in Activity

android,memory-leaks,firebase,firebase-android,leakcanary
I added the awesome LeakCanary library in my app and pretty soon I started to receive various reports for a leak generated by the FirebaseAuth Object that I use in the various activities. Now my question is: is it a leak generated by the Firebase library itself or I should...

## How do I implement firebase using React native?

firebase,react-native
When I try to use npm install to use firebase with React native, I am getting errors. Then when I try to use require for the firebase module, it says that the document can't be found. Is there a way to utilize the firebase API with React native instead?...

## How to detect a client that stops listening in firebase?

firebase,firebase-android
Let's say I have 3 clients that are listening for changes on some firebase root. Each client represents themselves as a user in a List (or Map) on the root. I want to remove a user that loses their connection or closes their client app (i.e. stops listening). How can...

## Listen for changes on data in Firebase (AngularFire)

javascript,angularjs,firebase,angularfire
Is it possible to listen for Firebase server updates on the DOM in AngularFire? I want to be able to fetch any updates when they are returned from the server to update the values of an array. Basically my problem is that I am using Firebase.ServerValues.TIMESTAMP which is set by...

## Getting Websocket Failure when trying to anonymously authenticate user using AngularFire

angularjs,firebase,angularfire
I am trying to anonymously authenticate users using AngularFire. I want to authenticate a user only once (so, if the user has already been authenticated, a new uid won't be generated). When I use the code below, I get a previous_websocket_failure notification. I also get an error in the console...

## Firebase - Object vs Array and Returning a .key()

javascript,arrays,object,firebase,angularfire
I'm using firebase + angularfire for a project that involves multiple users editing data at the same time (which would make an object ideal) as well as the need to quickly sort and filter the data on the fly (ideal for an array). So, would it be better for me...

## AngularJS - Firebase - Promise Error

javascript,angularjs,firebase

## Using Ionic - Cannot get Firebase to load properly - Error: Module 'firebase' is not available

javascript,angularjs,firebase,ionic,angularfire
I have looked at the following questions and have not been able to find an effective solution, hence I am posting another question. Ionic + firebase, error Module 'firebase' is not available Firebase, AngularFire Error: Module firebase is not available Angularfire 'Firebase' is not defined I am very much a...

## Using Chrome Console with Firebase

javascript,console,firebase
As a js newbie, this is probably a dumb question. But how can I actually use js within a Chrome console. I am trying to interact with my Firebase via the console but when I try to get the Firebase reference I keep getting undefined. I know I can use...

## Polymer+Firebase Element - Show spinner while updating data

firebase,spinner,polymer
I'm trying to learn Polymer, but I have some questions and can't find the solutions anywhere. I want to put a loading spinner in my app, while the data is being retrieved from firebase (using firebase-element) to fill the screen info. How can I detect that all data/elements are already...

## Is it necessary to call .off() if firebaseRef set to new value?

javascript,firebase,firebase-database
If I do: var firebaseRef = new Firebase(url); firebaseRef.on("value", function(dataSnapshot) { ... }); And then I reset firebaseRef like: firebaseRef = new Firebase(newUrl); Will the previous .on(...) listener be automatically removed or should I call .off() before setting firebaseRef to a new Firebase(newUrl)...

## How to Convert Firebase data to Java Object…?

java,android,firebase
Using Firebase Library to send data to the server in the form Message(String,String) added to the HashMap Example: Firebase fb=new Firebase(URL); Firebase msgRef = fb.child("finished"); HashMap<String, Message> msgList = new HashMap<>(); Message msg = new Message(m, n); msgList.put(HASHKEY, msg); msgRef.push().setValue(msgList); While Receiving Data with firebase method addValueEventListener() getting String in...

## Iterate nodes to get child key value

javascript,node.js,firebase
So here is how my test firebase looks I want to be able to go through the entire list and match the name with a string and if it matches, return the CID. This is what I'm trying from the official documentation but it returns undefined. fb.on('value', function(snapshot){ var data...

## Firebase data ordering

android,firebase
I feel as if I'm missing something big when I use firebase in my android app. I have been using push(); to put my data in firebase with a unique id. I have been accessing this data in an activity using the ChildEventListener: ref.addChildEventListener(new ChildEventListener() { // Retrieve new posts...

## Message gurantees on rapidly updated entities in Firebase

firebase
I'd like to understand how Firebase and listening Clients behave in the situation where a large number of updates are made to an entity in a short amount of time, and a client is listening to 'value' changes on that entity. Say I have an entity in firebase with some...

## Display items in reverse order from Firebase in ng-repeat

firebase,ionic-framework,angularfire
My issue is similar to the SO question below Reverse order of items pulled from database in ng-repeat HOWEVER, I am using the following method to bind all the transactions for a specific AccountID var syncObject = $firebaseObject(fb.child("members/" + fbAuth.uid + "/accounts/" +$scope.AccountId)); syncObject.$bindTo($scope, "data"); The difference from the...