0
Angular JSを使用してHTMlのドロップダウンリストにJSON応答を表示しようとしています。角度jを使用してhtmlドロップダウンリストでjson応答を表示する方法
私は、htmlの代理店のドロップダウンリストで「短い名前」を呼び出そうとしています。 アイデア前もって感謝します。
私のJSONコード
[{"id":1,"agencyCode":"006","agencyDescription":"null","shortName":"NJTA","cscId":1,"iagAgencyTypeId":4,"comments":"null","whoCreated":"admin","createdDate":"2016-06-13","whoUpdated":"admin","updatedDate":"2016-06-13"}]
HTMLコード
<div class="dashboard_searcharea">
<div class="col-md-3" ng-repeat="shortname in agencies"> Agency :
<select class="text_field_style smallfield">
<option value="shortname"> agencies: {{agencies.shortname}} </option>
</select>
</div>
<div class="col-md-3"> Events :
<select class="text_field_style smallfield">
</select>
</div>
角度JS
Dashboard.controller('homeController',homeController);
function homeController($scope,$location,$http) {
$scope.dt = new Date();
$scope.popup1 = {
opened: false
};
$scope.open1 = function() {
$scope.popup1.opened = true;
};
$http.get("http://localhost:8080/EtbosAdmin/agencies")
.success(function(response) {
$scope.metrics=response.series[0].shortname;
のために作成したあなたの応答ナガサイいただきありがとうございます。しかし何らかの理由で私の範囲が機能していません。それはそれを行う正しい方法です。 – Jithin
はいJithin、あなたの応答データやJSONオブジェクトを代理店の変数に代入してみてください。私が言及したコードはあなたのために働くでしょう –
あなたのコードで試しましたが、運はありません。質問はURL http:// localhost:8080/EtbosAdmin/agenciesからデータを受け取りますか?それはリンクから動的に動作しません。 – Jithin