2016-05-16 34 views
0

我有一個小應用程序來顯示來自不同的Web服務的一些JSON數據,我的代碼是http://play.ionic.io/app/44e0a65d2252。 第二個網址不顯示註釋,我做錯了什麼?爲什麼我的選擇選項中沒有顯示任何數據?

非常感謝。

JS:

this.showSelectValue = function(mySelect) { 
    $http.get("http://www.stcp.pt/pt//itinerarium/callservice.php?action=linedirslist&lcode="+mySelect) 
    .success(function (datadir){ 
     self.direcoes = datadir.records; 
     DataStore.direcoes = self.direcoes; 
    }) 
    .error(function(error){ 
     DataStore.direcoes.length = 0; 
    }); 

HTML:

<p>Selecione o sentido:</p> 
<ion-refresher pulling-text="Pull to refresh..." on-refresh="homeCtl.showSelectValue()"> 
</ion-refresher> 
<select> 
    <option ng-repeat="direcao in StopAsCtrl.direcoes" value="{{direcao.dir}}">{{direcao.descr_dir}}</option> 
</select> 

回答

0

你重複產品:

<option ng-repeat="direcao in StopAsCtrl.direcoes" value="{{direcao.dir}}">{{direcao.dir}}</option> 

你不是已經StopAsCtrl任何地方所定義。相反,direcoes也在homeController中定義。

您應該將in StopAsCtrl.direcoes更改爲in homeCtl.direcoes或在$stateProvider中定義StopAsCtrl。

編輯基於評論:

你不得不仍然在你的HTML和JS這麼多的問題。這裏是你已經工作代碼的部分例子:

http://play.ionic.io/app/21f5b7454a7d

你,我不會代碼整個應用程序,但是當更多的麻煩來了,你可以要求對堆棧溢出的新問題。

+0

當我改變你的消化仍然無法工作,你可以證明在http://play.ionic.io/app/44e0a65d2252 – user3332475

+0

我更新了我的答案給你。 – thepio

相關問題