FAQ
main.js file:

(function(window, angular, undefined) {

"use strict";

angular.module('plan4me', ["firebase"])
.factory("Task", ["$firebase", function($firebase) {
     var ref = new Firebase("https://xxxxxxxxxx.firebaseio.com/
<https://plan4meapp.firebaseio.com/>");
     return $firebase(ref);
}])
.controller("AddListItemController", ["$scope", "Task", function($scope,
Task) {
    $scope.addTask = function() {
     $scope.newTask = Task;
     $scope.newTask.$add($scope.inputTask);

};
}]);

})(window, window.angular);


It gave me back the whole collection, which I only need the last item's
value. Example, {"-JRweroijwofjD" : "Liz A." , "-JRqqdnslejNeiepP" : "Kim
L."}

I only want my name, Kim L., back from the firebase.

How do I do that?

Thank you!
Kimberly

--
You received this message because you are subscribed to the Google Groups "Firebase + AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-angular+unsubscribe@googlegroups.com.
To post to this group, send email to firebase-angular@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-angular/c55a66a1-4af2-4209-b663-2a3e6da66a70%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Jacob Wenger at Jul 14, 2014 at 10:34 pm
    Hey Kimberly,

    When you create your Firebase ref, you can pass it a limit() query
    <https://www.firebase.com/docs/javascript/firebase/limit.html>. To return
    the last five things, you'd do limit(5). To return only the last one, you'd
    do limit(1). Your factory should look like this (things in *bold* changed):

    .factory("Task", ["$firebase", function($firebase) {
         var ref = new Firebase("https://xxxxxxxxxx.firebaseio.com/
    <https://plan4meapp.firebaseio.com/>")*.limit(1)*;
         return $firebase(ref);
    }])

    Jacob
    On Monday, July 14, 2014 3:13:24 PM UTC-7, Kimberly Lin wrote:

    main.js file:

    (function(window, angular, undefined) {

    "use strict";

    angular.module('plan4me', ["firebase"])
    .factory("Task", ["$firebase", function($firebase) {
    var ref = new Firebase("https://xxxxxxxxxx.firebaseio.com/
    <https://plan4meapp.firebaseio.com/>");
    return $firebase(ref);
    }])
    .controller("AddListItemController", ["$scope", "Task", function($scope,
    Task) {
    $scope.addTask = function() {
    $scope.newTask = Task;
    $scope.newTask.$add($scope.inputTask);

    };
    }]);

    })(window, window.angular);


    It gave me back the whole collection, which I only need the last item's
    value. Example, {"-JRweroijwofjD" : "Liz A." , "-JRqqdnslejNeiepP" : "Kim
    L."}

    I only want my name, Kim L., back from the firebase.

    How do I do that?

    Thank you!
    Kimberly
    --
    You received this message because you are subscribed to the Google Groups "Firebase + AngularJS" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to firebase-angular+unsubscribe@googlegroups.com.
    To post to this group, send email to firebase-angular@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-angular/dfb680a7-6813-4a14-b618-38b2b75aab52%40googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupfirebase-angular @
postedJul 14, '14 at 10:16p
activeJul 14, '14 at 10:34p
posts2
users2

2 users in discussion

Jacob Wenger: 1 post Kimberly Lin: 1 post

People

Translate

site design / logo © 2021 Grokbase