Search Posts

Category: angularfire

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 $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 […]

Check whether user is anonymous in AngularFire

I have read the document in AngularFire 1 about Authentication. However, I cannot find out how to check whether the current user is anonymous. Here is what I tried .controller(‘IndexCtrl’,[‘$scope’,’$route’,’Auth’, function($scope,$route,Auth){ //Check whether user is existent $scope.isExistent = function(){ var isIt = true; if(firebaseUser.isAnonymous()){ isIt = false; console.log(“is anonyous”); } return isIt; }; }]); Any help would be appreciated. Source: AngularJS

Retrieving Object from Firebase (AngularFire)

I try to get an object from Firebase with AngularFire and use firebaseObject. However, it did not return an object as I expected. Here is my code (function(){ ‘use strict’; angular.module(‘moiveapp’, [‘ngRoute’],[‘firebase’]) .factory(“Movie”, [“$firebaseObject”, function($firebaseObject) { return function(ID) { // create a reference to the database node where we will store our data var ref = firebase.database().ref(“allmovies”).push(); var movieRef = ref.child(ID); // return it as a synchronized object return $firebaseObject(movieRef); } } ]) .controller(“MovieCtrl”, [‘$scope’,’Movie’, […]

AngularFire FirebaseArray $save only saves once

Im trying to save input after the submit button is clicked. $scope.edit = function() { $timeout(function() { $scope.settings.$save(settings[0].$value); $scope.settings.$save(settings[1].$value); $scope.settings.$save(settings[2].$value); $scope.settings.$save(settings[4].$value); $scope.$apply(); }) }; It only saves the first one, then if I click again and the first field was unedited, it saves the second one, and so on… How can I make it save everything to Firebase just from one click. Source: AngularJS

┘ÉAngularFireList push can’t identify model values

here is my ChatMessage model : export class ChatMessage{ $key?: string; email?:string; userName?:string; message?:string; timeSent?: Date = new Date(); } and this is my code for AngularFireList: chatMessages: AngularFireList<ChatMessage[]>; const timestamp = this.getTimeStamp(); //const email = this.user.email; const email = “[email protected]”; this.chatMessages.push({ message: msg, timeSent: timestamp, email: email, //userName: this.userName, userName: “user-test”, }); i have an error saying: ‘ message: ‘Argument of type ‘{ message: string; timeSent: string; email: string; userName: string; }’ is not […]

AngularFirstore is not defined

I am doing a simply angular app with angularfire and firebase. But I have a problem with Angularfire. The error on console says: Uncaught ReferenceError: AngularFirstore is not defined at eval (app.module.ts:15) at eval (app.module.ts:18) my app.modudule.ts is import { BrowserModule } from “@angular/platform-browser”; import { NgModule } from “@angular/core”; import { AppComponent } from “./app.component”; import { AngularFireModule } from “angularfire2”; import { environment } from “../environments/environment”; import { AngularFirestore } from ‘angularfire2/firestore’; @NgModule({ […]

Angular Module not available when using $(document).ready()

I’m getting a curious error similar to some other posts, but I haven’t been able to remedy. I’m using jQuery’s document.ready() to ensure that all the buttons are loaded before referencing my local Javascript file that includes an AngularJS front-end incorporated with Firebase and Angularfire. I’m getting the following error in the console that typically accompanies an Angular controller with an unreferenced or uninitialized dependency injection: Error: [$injector:nomod] Module ‘myApp’ is not available! You either […]

How to configure AngularFire for Multiple Firebase Projects

I am attempting to configure my AngularFire (2.3.0) – (This uses Angular 1.x) app to handle multiple firebase projects. Firebase has a reference in their docs for this possibility. Here is a snippet of how to initialize a single database. // Initialize Firebase // TODO: Replace with your project’s customized code snippet var config = { apiKey: “<API_KEY>”, authDomain: “<PROJECT_ID>.firebaseapp.com”, databaseURL: “https://<DATABASE_NAME>.firebaseio.com”, storageBucket: “<BUCKET>.appspot.com”, messagingSenderId: “<SENDER_ID>”, }; firebase.initializeApp(config); Here is how you would add another […]

Angularfire $firebaseArray extend dynamic countsum

Am trying to achieve a dynamic count of certain node if defined: This works but its not dynamic, you have to call sum(). app.factory(“ArrayWithSum”, function($firebaseArray) { return $firebaseArray.$extend({ sum: function() { var total = 0; var todayDate = new Date(); var start = todayDate.setHours(0,0,0,0); var end = todayDate.setHours(23,59,59,999); // the array data is located in this.$list angular.forEach(this.$list, function(rec) { if (angular.isDefined(rec.qa)){ if (angular.isDefined(rec.qa.completed)) { if (rec.qa.completed >= start && rec.qa.completed <= end){ total++; } } […]

Next Page »