angularfire

$authWithPassword is not a function in AngularFire 2.x

戏子无情 提交于 2020-01-14 02:04:07
问题 I've seen posts about this problem before, but they're either outdated or offer a solution very similar to my setup. Basically, I have two functions in my controller: authCtrl.login and authCtrl.register. The register's call to Auth.$createUserWithEmailAndPassword() works fine, but the login's call to Auth.$authWithPassword() does not, as I'm getting a "..is not a function" error. Can't for the life of me figure out what is wrong here. Here's my setup: auth.service.js: angular.module(

Fetching item by unique firebase id in angularfire 1.0.0

£可爱£侵袭症+ 提交于 2020-01-13 18:19:48
问题 I have trouble fetching one unique item from my firebase using angularfire 1.0.0. To clarify, I want my app to fetch a post given a unique firebase id e.g. "-JkZwz-tyYoRLoRqlI_I". It works when navigating in the app e.g. clicking on a link to a specific post, but not on a refresh. My guess is that it has something to do with synchronization. Right now it works when fetching all posts and use it in a ng-repeat. This is a clue to why it works for one item when navigating to the page. This

firebase $add() .push() .set()

蹲街弑〆低调 提交于 2020-01-13 10:19:05
问题 I am using firebase, and angularfire. there are so many ways to do CRUD with the Firebase Api actually, I still don't get what is specific difference for using $add with $firebaseArray .push() method .set() method I think they are technically same, I prefer to use .set method() without knowing the exact reason, why I'd using that. is there any specific reason to not use it? what is exactly $firebaseArray did? if we could just declare basic reference variable. in this case: var usersRef = Ref

AngularFire Accessing child element methods

喜欢而已 提交于 2020-01-13 05:50:12
问题 I'm looking for a way to get the methods of a child element instead of loading that element separately. Let's say I have a Post model and each post has comments. This is how I get the post model: var post = $firebase(new Firebase(FIREBASE_URL + "/posts/" + post_name)).$asObject(); Each post has comments so I can access the comments using: post.$loaded(function () { var comments = post.comments; } Now how do I push a new element to comments without having to load the model separately from

Firebase angularfire child.$asObject give properties undefined

不羁的心 提交于 2020-01-09 08:18:09
问题 I've got this code: factory app.factory('Items', function($firebase,FIREBASE_URL) { var ref = new Firebase(FIREBASE_URL); var items = $firebase(ref.child('items')).$asArray(); var Item = { all: function () { return items; }, create: function (item) { return items.$add(item); }, get: function (itemId) { return $firebase(ref.child('items').child(itemId)).$asObject(); }, update: function (itemId, item) { return $firebase(ref.child('items').child(itemId)).update(item); }, delete: function (item)

Retrieving data from firebase while sorting it correctly

ⅰ亾dé卋堺 提交于 2020-01-07 02:29:14
问题 I have this structure in my firebase database "metadata" : { "2017" : { "Februari" : { "-Kc3BF0V1iLgtnI65LuR" : { "date" : "2017-02-03T13:36:38.311Z", "price" : 90 }, "-Kc3BF0V1xxfrtnI65OlS" : { "date" : "2017-02-03T13:36:38.311Z", "price" : 90 } }, "Januari" : { "-Kc3E5bpxpo3RpSHH3fn" : { "date" : "2017-01-11T13:50:12.264Z", "price" : 45 } } } } What I am trying to achieve in my app is to show a list like this > Januari > - 45 (=price) > > Februari > - 90 () > - 240 The thing is I am able to

firebase - Use one ref for an object and push onto it's child array

醉酒当歌 提交于 2020-01-06 02:52:07
问题 This code works however I'm using two refs to access different areas of the same object. A routine may have multiple pages. Is there a way to create new pages and just use one ref to push pages onto $scope.routine.pages that also create a unique id? angular.module('screenTester.auth.routine', [ 'screenTester.auth.routine.page' ]) .config(['$stateProvider', function($stateProvider) { $stateProvider .state('auth.routine', { url: '/routine/:routineId', controller: 'RoutineCtrl', templateUrl: '

Creating and adding to arrays in angularFire / Firebase

◇◆丶佛笑我妖孽 提交于 2020-01-05 08:06:00
问题 I am trying to build an app with angularjs and Firebase similar to a forum for helping my classmates with problems. I also want people to be able to 'reply' to the specific problems the classmates are having, so I create an object with many values in the angularjs factory, like this: factory.addError = function() { factory.errors.$add({ ... replies: [] }); }; The problem with this is that Firebase doesn't save parameters with empty values for placeholders, such as the parameter 'replies'

AngularFire V1.2 $firebaseArray() $loaded() only called once [duplicate]

与世无争的帅哥 提交于 2020-01-05 06:49:30
问题 This question already has an answer here : $on loaded fires once for new references AngularFire 0.5.0 (1 answer) Closed last year . 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

How to roll back changes when there is an error in a promise chain

亡梦爱人 提交于 2020-01-04 09:03:55
问题 In my angular app I want to make changes to several locations in my firebase with a mix of transactions and set. I have written a promise chain with a little help. Now I need to handle any errors that may occur. In the event of an error on any of the promises I would want to roll back any changes made in firebase (the successful promises) and alert the user to the failure. Current code below $scope.addNewPost = function() { var refPosts = new Firebase(FBURL).child('/posts').push(); // Get