1
显示我有一个角的js应用。我使用GAPI登录,然后调用我的谷歌云终端获取数据。登录事情工作正常,它也从终点获取数据。AngularJS:由GAPI客户端读取的数据不会对UI
但它取出数据后,如果我的数据分配给一个变量$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));
}
});
}
问候, 纳迪姆乌拉
非常感谢Andre Goncalves,这工作得很好:-) –