【发布时间】:2018-01-31 19:01:40
【问题描述】:
我正在尝试显示我的 firebase 数据库中的产品列表,但 2 路绑定对我不起作用。 $scope.products 会更新并在控制台上打印,但不会在 UI 上更新。
app.controller("productManagerController", ["$scope", function ($scope) {
$scope.products = [];
db.ref("products").once('value').then(function (snapshot) {
const values = snapshot.val()
for (key in values) {
values[key].id = key;
$scope.products.push(values[key])
}
console.log($scope.products) // Logs the values that have been taken from firebase
// But doesn't update on the UI
})
}])
【问题讨论】:
标签: javascript angularjs firebase firebase-realtime-database