这是我的代码,我不能得到值,目前有三个值,但值不显示:
<body ng-controller="bucksbucket_orders">
<form >
<li ng-repeat="message in syncfromfbvalues">
{{message.milk}},{{message.newspaper}},{{message.greens}}</li>
</form>
</body>
下面是我尝试从firebase
获取的值values
|--->greens: "56"
|===> milk: "56"
|===>newspaper: "56"
我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
变化:
$scope.defaultfbvalues = function () {
fbvalues.set({
"newspaper": '56',
"milk": '56',
"greens": '56'
});
};
:
$scope.defaultfbvalues = function () {
fbvalues.set([{
"newspaper": '56',
"milk": '56',
"greens": '56'
}]);
};
fbvalues是数组"[]"
AngularFire的$firebaseArray
是为典型的Firebase序列而构建的,其中的键是-J-0FSHRJ913A
的形式,通常不显示。
在您的示例中,您将希望同时显示$id
和$value
:
<li ng-repeat="message in syncfromfbvalues">
{{message.$id}} - {{message.$value}}
</li>
显示:
- 绿色- 56
- 牛奶- 56
- 报纸- 56