gpt4 book ai didi

javascript - Angular js - 在异步调用 $scope.users 后不更新模态值

转载 作者:行者123 更新时间:2023-11-30 07:57:16 24 4
gpt4 key购买 nike

app.controller('tableController', function ($scope, $filter, ngTableParams,$http){

$scope.users = [];

$http.get("getjsondata").success(function (response) {
$scope.users = response; //ajax request to fetch data into $scope.data
});

console.log($scope.users); // I am not getting the updated value as
// I need to pass this value in another function
});

最佳答案

成功函数是调用完成后的回调,如果您想查看必须调用任何其他函数或在回调中传递任何值的值

喜欢

$scope.users = [];
$http.get("getjsondata").success(function (response) {
$scope.users = response;
console.log($scope.users);
});

关于javascript - Angular js - 在异步调用 $scope.users 后不更新模态值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36859074/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com