angularfire

Firebase push() vs Angularfire $save()

扶醉桌前 提交于 2019-12-05 14:44:31
How does angularfire .$save() compare to firebase .push()? I know push() will generate a unique key when data is stored, but I can't recreate the behavior using angularfire. Is there a way or should I be using .push() and if so, in what case would you use $save()? Here is one sample I have using $save()... var fb = new Firebase(FIREBASE_URI).child('Test'); var article = $firebaseObject(fb); article.Foo = "bar"; article.$save().then(function(fb) { console.log(fb.key() === article.$id); // true }, function(error) { console.log("Error:", error); }); And another using .push()... var article = new

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

我是研究僧i 提交于 2019-12-05 10:28:58
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.child('users'); $scope.createUser = function() { $scope.userRef.child($id).set({ name: name }); }; or

Firebase 3-way data binding with ControllerAs syntax

﹥>﹥吖頭↗ 提交于 2019-12-05 09:43:57
I'm tring to get 3-way data binding with firebase and angularfire. You can see what I've got in Plunker: http://plnkr.co/edit/RGA4jZK3Y6n4RkPCHK37 app.js : angular.module('ideaBattle', ["firebase"]); services : angular .module('ideaBattle') .constant('FBURL', 'https://ideabattle.firebaseio.com/') .service('Ref', ['FBURL', Firebase]) .factory('dataBank', function(Ref, $firebase) { return $firebase(Ref).$asArray(); }); controller : angular .module('ideaBattle') .controller('ideaListCtrl', displayIdeas); displayIdeas.$inject = ['dataBank']; function displayIdeas(dataBank){ var vm = this; vm.ideas

Uncaught Error: A network error

喜欢而已 提交于 2019-12-05 06:53:40
after I've tried to use the firebase authentication service, I got an uncaught error: a network error (such as timeout, interrupted connection or unreachable host) has occurred I have tried to whitelist all related domain-names: <allow-intent href="*.firebaseio.com" /> <allow-intent href="*.firebaseapp.com" /> <allow-intent href="*.google.com" /> <allow-intent href="*.googleapis.com" /> <allow-intent href="*.cloudflare.com" /> <allow-intent href="auth.firebase.com" /> <access origin="*" /> and ask for internet user permission: <uses-permission android:name="android.permission.INTERNET" />

How to check if data exists in firebase using angularfire?

和自甴很熟 提交于 2019-12-05 02:10:00
问题 I would like to register users manually in firebase. How can i check if the user is registered already or if his ( USERID ) exists? If it exists it should not let him register otherwise if his userid is not yet on the database then his info should be saved. Here is my current code wherein only saving userinfo is still available. $scope.details={}; $scope.registerme= function() { var someDate = new Date(); var ref = firebase.database().ref('/Users/'); $scope.submitme = $firebaseArray(ref);

Finding correct Firebase Auth id_token on $onAuthStateChanged

别说谁变了你拦得住时间么 提交于 2019-12-05 00:41:40
I am currently using Angular 1.5.8 , Firebase 3.3.0 , and AngularFire 2.0.2 . When I call $firebaseAuth.$signInWithPopup , the promise returns with a firebase user that includes firebase.user.idToken , but when I call $onAuthStateChanged , firebase user does not return with a .user property. What is the correct token to use for server authentication from the $onAuthStateChanged function? I was using the md property, but then it stopped working and switched to a kd property and I realized that not every user has that. Is it the _lat property? It seems to work this way, but I can't seem to find

How do I get angularFire objects to orderBy with ngRepeat?

北慕城南 提交于 2019-12-04 22:29:48
问题 The current bunch of data in my firebase looks something like: {"-JZ7b":{"name":"bob","has":"slack"},"-JZ7a":{"name":"connie","has":"slack"}} If I use something like: <ul><li ng-repeat="(key, person) in people |orderBy 'name'"></li></ul> I get: -JZ7a connie has slack -JZ7b bob has slack here's a fiddle What is the best way to get the expected orderBy without changing my data into some other format? I realize that in this example the keys aren't exactly meaningful but, assume they are. The

Firebase newest feed for following users

為{幸葍}努か 提交于 2019-12-04 18:19:56
I'm working with Angularjs and Firebase. Right now I'm new at firebase for this I'm struggling to find solutions for my issues. Imagine I'm sorting users like this users:{ facebook:123456789:{ blog: [{ // List of blogs }], following: [{ // List of users auth.ids }] }, facebook:123456780:{ blog: [{ // List of blogs }], following: [{ // List of users auth.ids }] } } And getting logged in user blog object and iterating and pushing it to the array like this var blogRef = new Firebase(FirebaseUrl + "/users/" + authData.uid + "/blog"); var userBlog = $firebaseArray(blogRef); var userBlogDatas = []

Uploading video to Firebase uing ngCordova ($cordovaCapture) in ionic framework

余生长醉 提交于 2019-12-04 17:59:48
How to upload video that I record using my mobile. I manage to upload the video path to Firebase but when I want to use it in my view (html file), it does not work. Here is my code: .controller("HomeCtrl", function($scope, $firebaseArray, $cordovaCamera, $location, $cordovaCapture){ var fb = new Firebase("https://myURL.firebaseio.com/videos"); $scope.videos; $scope.record = function(){ fb = new Firebase("https://myURL.firebaseio.com/videos"); $scope.videos = $firebaseArray(fb); var options = { limit: 1, duration: 15 }; $cordovaCapture.captureVideo(options).then( function(videoData) { var i,

Cordova inAppBrowser won't work with firebaseAuth

青春壹個敷衍的年華 提交于 2019-12-04 16:26:52
I am building a hybrid app using the ionic framework. I'm using angularFire 2.0 with Firebase 3.0. I have the cordova plugin "inAppBrowser" installed. In the depreciated Firebase documents, that's all I need to have authWithOAuthPopup() fire up an inAppBrowser window and do the login process. Currently, I am using signInWithPopup() and it does nothing in my iOS app. The app works fine in browser using ionic serve. Firebase 3.0 signInWithPopup/Redirect is not currently supported in a Cordova environment even with inAppBrowser plugin installed. Until this is supported, you can use other plugins