如何在打开模型屏幕之前从服务器下载数据?
how to download data from server before open the model screen?
你能告诉我如何在打开模型屏幕之前从服务器下载数据吗?我可以使用 http 请求从服务器下载数据。但我首先有几个问题是从服务器下载数据的最佳方式吗在打开模型屏幕之前。其次如何在模型中发送数据。换句话说,我需要在模型屏幕中发送下载数据对象以显示 Web 服务的竞争。你能帮我怎么做吗?
这是我的代码
点击按钮我调用网络服务
$scope.openmodel=function(){
我需要在模型屏幕上发送网络服务数据
<ion-modal-view>
<ion-header-bar class="bar-balanced">
<h1 class="title">departure</h1>
</ion-header-bar>
<ion-content scroll="false">
<ion-scroll direction="y" class="departurecontainer">
<div class="row rowclass" ng-repeat="obj in data.data">
<div class="col">
{{obj.schDepart}}
</div>
<div class="col">
{{obj.expDepart}}
</div>
</div>
</ion-scroll>
</ion-content>
<ion-footer-bar class="bar-balanced">
<h1 class="title">Footer</h1>
</ion-footer-bar>
</ion-modal-view>
问题似乎出在您的 $scope.openmodel 变量中
$scope.openmodel = function(){
$http.get("http://caht.firstrail.com/FGRailApps/jservices/rest/a/departure?crsCode=PAD")
.success(function (data) {
$scope.data = data; // you forgot to set the data to $scope.data
alert(data);
console.log(data);
$scope.modalFirst.show();
}).error(function (err) {
alert(err);
});
};
你能告诉我如何在打开模型屏幕之前从服务器下载数据吗?我可以使用 http 请求从服务器下载数据。但我首先有几个问题是从服务器下载数据的最佳方式吗在打开模型屏幕之前。其次如何在模型中发送数据。换句话说,我需要在模型屏幕中发送下载数据对象以显示 Web 服务的竞争。你能帮我怎么做吗?
这是我的代码
点击按钮我调用网络服务
$scope.openmodel=function(){
我需要在模型屏幕上发送网络服务数据
<ion-modal-view>
<ion-header-bar class="bar-balanced">
<h1 class="title">departure</h1>
</ion-header-bar>
<ion-content scroll="false">
<ion-scroll direction="y" class="departurecontainer">
<div class="row rowclass" ng-repeat="obj in data.data">
<div class="col">
{{obj.schDepart}}
</div>
<div class="col">
{{obj.expDepart}}
</div>
</div>
</ion-scroll>
</ion-content>
<ion-footer-bar class="bar-balanced">
<h1 class="title">Footer</h1>
</ion-footer-bar>
</ion-modal-view>
问题似乎出在您的 $scope.openmodel 变量中
$scope.openmodel = function(){
$http.get("http://caht.firstrail.com/FGRailApps/jservices/rest/a/departure?crsCode=PAD")
.success(function (data) {
$scope.data = data; // you forgot to set the data to $scope.data
alert(data);
console.log(data);
$scope.modalFirst.show();
}).error(function (err) {
alert(err);
});
};