Jquery 角js有什么问题
我用js写的Jquery 角js有什么问题,jquery,angularjs,angularjs-scope,Jquery,Angularjs,Angularjs Scope,我用js写的 $scope.check = function () { $scope.searchName = ""; $.post("http://172.22.71.107:8888/check/", {}, function (arg_result) { if (arg_result.Ret == 0) { $scope.users = []; $scope.users = arg_result.D
$scope.check = function () {
$scope.searchName = "";
$.post("http://172.22.71.107:8888/check/", {},
function (arg_result) {
if (arg_result.Ret == 0) {
$scope.users = [];
$scope.users = arg_result.Data;
console.log($scope.users);
}
}, "json");
但是在html中,数据不能在收到rusult时更新,有什么问题吗?您正在使用jquery的post在外部更新$scope 您需要将作业包装成
$scope.$apply(function() {
$scope.users = [];
$scope.users = arg_result.Data;
});
或
使用angular为您提供的服务。这是首选方法。?