我在控制器中发送http请求,视图在加载时从Web服务呈现数据。其中一个网络服务需要很长时间才能完成,控制器代码:
$scope.doRefresh = function() {
//$http.get('http://inda208350.in.fid-intl.com:9090/appstatus/')
$http.get('http://inda232218.in.fid-intl.com:9090/appstatus/')
.success(function(newItems) {
$scope.content = newItems;
})
.finally(function() {
// Stop the ion-refresher from spinning
$scope.$broadcast('scroll.refreshComplete');
});
};
$ionicLoading.show({
content: 'Loading',
animation: 'fade-in',
showBackdrop: true,
maxWidth: 200,
showDelay: 10
});
// DataTables configurable options
$scope.dtOptions = DTOptionsBuilder.newOptions()
.withDisplayLength(10)
.withOption('bLengthChange', false);
/* Get App Status */
$http.get('http://inda232218.in.fid-intl.com:9090/appstatus/').success(function(responseAppsData){
$ionicLoading.hide();
$scope.content = responseAppsData;
$scope.appNm = $stateParams.appName;
$scope.appSt = $stateParams.appStatus;
})
.error(function(responseAppsData){
$ionicLoading.hide();
alert("Details Status Please call EPS for support..!!");
})
$ionicLoading.show({
content: 'Loading',
animation: 'fade-in',
showBackdrop: true,
maxWidth: 200,
showDelay: 10
});
/* Get Index Based Issues*/
$http.get('http://inda232218.in.fid-intl.com:9090/indexinfo/').success(function(responseAppsData){
$scope.content1 = responseAppsData;
$scope.app = $stateParams.appName;
})
.error(function(responseAppsData){
$ionicLoading.hide();
alert("Details Status Please call EPS for support..!!");
})
/* Get Holding Based Issues*/
$http.get('http://inda232218.in.fid-intl.com:9090/holdinginfo/').success(function(data, status, headers, config) {
$scope.content2 = data;
})
.error(function(responseAppsData){
$ionicLoading.hide();
alert("Details Status Please call EPS for support..!!");
})
/* Get Cash Based Issues*/
$http.get('http://inda232218.in.fid-intl.com:9090/cashdata/').success(function(data, status, headers, config) {
$scope.content4 = data;
})
.error(function(responseAppsData){
$ionicLoading.hide();
alert("Details Status Please call EPS for support..!!");
})
/* Get Discovery Based Issues*/
$http.get('http://inda232218.in.fid-intl.com:9090/discovery_details/').success(function(data, status, headers, config) {
$scope.content3 = data;
})
.error(function(responseAppsData){
$ionicLoading.hide();
alert("Please call EPS for support..!!");
})
$ionicLoading.hide();
})
控制器还包含以下服务: controller('DetailStatusCtrl',函数($ scope,$ stateParams,$ http,$ timeout,$ ionicLoading,DTOptionsBuilder,DTColumnBuilder,$ q)
在单个视图中,我想要一个表格/选项卡式数据,就像使用w3导航栏一样,点击一个栏,我会从1个网络服务获取数据,在其他选项卡上点击我会从其他网站获取数据-服务。我想到的解决方案之一是将控制器分解为2,然后在选项卡上单击调用特定控制器。任何人都可以帮助实现这种方法吗?