2016-05-16 12 views
0

私は別のWebサービスからいくつかのjsonデータを表示する小さなアプリケーションを持っています、私のコードはhttp://play.ionic.io/app/44e0a65d2252です。 2番目のURLには注意が表示されません。何が間違っていますか?選択オプションにデータが表示されないのはなぜですか?

ありがとうございました。

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がどこにも定義されていません。代わりに、direcoeshomeControllerに定義されています。

in StopAsCtrl.direcoesin homeCtl.direcoesに変更するか、$stateProviderにStopAsCtrlを定義する必要があります。コメントをもとに

EDIT:

あなたはまだあなたのhtmlとjsの中に非常に多くの問題を抱えていました。ここにあなたのコードの一部を作業しているあなたのための例です:

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

私はあなたのために全体のアプリをコーディングしないだろうが、より多くのトラブルは、あなたのように来るとき、あなたがスタックオーバーフローに新しい質問をすることができます。

+0

私はあなたのsugestionを変更してもまだ動作していないことを証明できます。http://play.ionic.io/app/44e0a65d2252 – user3332475

+0

私の答えはあなたのために更新されました。 – thepio

関連する問題