这是从服务器加载列表的功能。最初显示列表,但是当应用过滤器时获得空响应时,它仍显示先前的结果并且不清除先前的列表。为什么ng-repeate对象没有得到更新?
$scope.browseListing = function (strURL) {
$scope.CurrentTab = strURL;
$scope.getURL(strURL);
$http.post($scope.URL)
.then(function (response) {
if (response.data != 'null') {
$scope.Data = response.data;
$scope.TotalListingCount = $scope.Data.length;
$window.alert('Result is not null');
}
else {
$scope.TotalListingCount = '0';
$window.alert('Result is null');
$scope.Data = [];
}
}, function (response) {
$log.info(response);
});
};
编辑
如何解决这个问题,这样就空响应前面的清单将被清除,并没有显示出列表?
更新从服务器 – Aravind
@Aravind检索您的各自的HTML标记和JSON数据,我需要显示/隐藏NG-repeate按反应? – JMD
当没有数据时,您是否收到“Result is null”警报? –