看不到有关 ng-repeat 的数据
cant see data on ng-repeat
我正在使用 firebase 获取一些数据并显示它,
我的问题是我无法在模板上看到我的列表。
我的工厂是
return $firebaseArray(itemsRef);
我在 firebase 上的目标是
{
"contacts" : [ {
"active" : true,
"lastName" : "fdg",
"name" : "sdfdsf",
"number" : "052045454",
"table" : 3
}]}
控制器是
$scope.contacts =Items;
并显示它:
ng-repeat="(key, contact) in contacts
可能是什么问题?我可以看到 firebase return 数据...
是的,问题中有很多地方看起来不对劲。但我怀疑最有可能的问题是联系人是一个数组,而不是地图。因此,您最有可能需要做的是这些方面的事情:
<div ng-repeat="contact in contacts track by $index">
Active: {{contact.active}}, Contact Name: {{contact.name}} ...
</div>
或者这些(注意索引访问):
<div ng-repeat="(key, value) in contacts[0]">
key: {{key}}, Value: {{value}} ...
</div>
P.S。 "track by $index" 部分可能需要也可能不需要,具体取决于您的数据。
我正在使用 firebase 获取一些数据并显示它, 我的问题是我无法在模板上看到我的列表。 我的工厂是
return $firebaseArray(itemsRef);
我在 firebase 上的目标是
{
"contacts" : [ {
"active" : true,
"lastName" : "fdg",
"name" : "sdfdsf",
"number" : "052045454",
"table" : 3
}]}
控制器是
$scope.contacts =Items;
并显示它:
ng-repeat="(key, contact) in contacts
可能是什么问题?我可以看到 firebase return 数据...
是的,问题中有很多地方看起来不对劲。但我怀疑最有可能的问题是联系人是一个数组,而不是地图。因此,您最有可能需要做的是这些方面的事情:
<div ng-repeat="contact in contacts track by $index">
Active: {{contact.active}}, Contact Name: {{contact.name}} ...
</div>
或者这些(注意索引访问):
<div ng-repeat="(key, value) in contacts[0]">
key: {{key}}, Value: {{value}} ...
</div>
P.S。 "track by $index" 部分可能需要也可能不需要,具体取决于您的数据。