我有一个角度 js 应用程序。我正在使用 gapi 登录,然后调用我的谷歌云端点来获取数据。登录的东西工作正常,它也可以从端点获取数据。
但是在它获取数据之后,如果我将数据分配给一个$scope
变量(绑定到 UI),它不会更新 UI。甚至没有错误。下面是我的代码片段。有任何想法吗?
function TestCtrl($scope){
$scope.contactsList = [];//UI template is bound to this list
//Assuming the gapi client is already loaded
gapi.client.contactendpoint.list().execute(function(resp) {
if (!resp.code) {
$scope.contactsList = resp.items;//Does not update ui list
} else {
alert("Error, response is: "
+ angular.toJson(resp));
}
});
}
问候, 纳迪姆·乌拉