0

Here is my code I can"t get the values , presently three values are present but values are not displaying:

<body ng-controller="bucksbucket_orders">
    <form >
        <li ng-repeat="message in syncfromfbvalues">
            {{message.milk}},{{message.newspaper}},{{message.greens}}</li>
    </form>
</body>

Here is the values I try to get from firebase

values
 |--->greens: "56"
 |===> milk: "56"
 |===>newspaper: "56"

My app.js

var fbvalues = new Firebase("https://qwertyuiop.firebaseio.com/values");

$scope.defaultfbvalues = function () {
    fbvalues.set({
        "newspaper": '56',
        "milk": '56',
        "greens": '56'
    });
};

$scope.syncfromfbvalues = $firebaseArray(fbvalues);

my plunker demo : http://embed.plnkr.co/acFOlruX0t4bCIxXohAF/preview

13
  • If you just do {{message}} in your repeat what do you get? Commented Oct 4, 2015 at 18:11
  • does it work with scope.defaultfbvalues? Commented Oct 4, 2015 at 18:11
  • 1
    @ergonaut that wont work defaultfbvalues is a method adding something to fbvalues. Not the collection itself. Commented Oct 4, 2015 at 18:12
  • @ste2425 {"$value":"56","$id":"greens","$priority":null} {"$value":"56","$id":"milk","$priority":null} {"$value":"56","$id":"newspaper","$priority":null} Commented Oct 4, 2015 at 18:13
  • 1
    Why are you using ng-repeat and $firebaseArray instead of $firebaseObject? Commented Oct 4, 2015 at 18:43

2 Answers 2

1

Change:

$scope.defaultfbvalues = function () {
     fbvalues.set({
          "newspaper": '56',
          "milk": '56',
          "greens": '56'
     });
};

To:

$scope.defaultfbvalues = function () {
     fbvalues.set([{
          "newspaper": '56',
          "milk": '56',
          "greens": '56'
     }]);
};

The fbvalues is array "[ ]"

Sign up to request clarification or add additional context in comments.

2 Comments

good it"s working fine but i figure out other way too !!! ... $scope.defaultfbvalues = function () { fbvalues.set({ "newspaper": '56', "milk": '56', "greens": '56' }); }; to $scope.defaultfbvalues = function () { fbvalues.push({ "newspaper": '56', "milk": '56', "greens": '56' }); }; change the set value to push and also your code works fine too but how can it created nested value as 0 ?
I not understand. Please question again?
0

The AngularFire $firebaseArray is built to work with typical Firebase sequences, where the keys are in the form of -J-0FSHRJ913A and usually not displayed.

In your case, you'll want to display both the $id and $value:

<li ng-repeat="message in syncfromfbvalues">
    {{message.$id}} - {{message.$value}}
</li>

Which displays:

  • greens - 56
  • milk - 56
  • newspaper - 56

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.