我有一个表格显示来自远程服务器的数据。有一个数字输入,当数字更改时,我希望刷新表格(在 arg 中输入数字)。
这是我目前的尝试:
$scope.$watch("number", function () {
console.log("number changed");
$scope.user_table_columns.length = 0;
$scope.user_table_columns = [
{ title: 'Loading... (give it 20-25 seconds)', visible: true}
];
if (typeof $scope.stats != "undefined")
$scope.stats.length = 0;
$scope.stats = [];
//$scope.tableParams.reload();
$http.get("/api/thing/"+$scope.number).then(function (result) {
$scope.table_data = result.data;
$scope.user_table_columns.length = 0;
Object.keys($scope.stats[0]).forEach(function (col) {
$scope.user_table_columns.push({ title: col, field: col, visible: true })
});
})
});
我进入number changed
我的日志;但没有新的 HTTP 请求。