内部我的角度控制器我有以下方法定义AngularJS数据绑定和jQuery承诺
$scope.searchListing = function() {
$http({
url: App.Url.to('listing/feed/21312')
}).success(function(data, status, headers, config) {
$scope.data = data;
});
}
在视图中,$ scope.data.listing环绕
<div class="item" ng-repeat="property in data.listings"><!-- stuff --></div>
searchListing使用NG-触发点击和事情完美的作品。不过,我有一个单独的API处理对我的应用程序的API调用,它基于jQuery。在我的基于jQuery的API集成之后
$scope.searchListing = function() {
App.Listing.getListing().done(function(data){
$scope.data = data;
});
}
API返回jqXHR对象,所以我可以调用它们的promise方法。问题是即使数据被分配到$ scope.data我的视图没有得到更新。 Ajax请求完成后我访问控制器检查,如果数据得到了分配
angular.element('[ng-controller=listingController]').scope().data
而且它确实显示出数据,为什么不看法得到更新?
有采用了棱角分明'$ http'或'$ resource'因为范围已接受承诺 – charlietfl