-1
コードは角度jsです。 jsonのリンクからリストを取得できましたが、リスト内の不要な項目をフィルタリングする必要があります。角度js:リスト内の不要な項目をフィルタリングします
IDが4桁を超える場合は、full_name、name、short_nameおよびidを削除します。例:id:123456の場合、フィルタアウトする必要があります。
app.js
kls: {
name: "Momo",
value: "kls",
long: "KLSE",
searchRef: KLSE_SEARCH_REF,
searchRefURL: "http://www.bursamalaysia.com/searchbox_data.json",
},
details.js
$ionicLoading.show();
if($scope.currentMarket == "kls") {
$webServicesFactory.getNotParsed($marketProvider[$scope.currentMarket].searchRefURL).then(
function success(response) {
response = JSON.parse(response);
for(var i=0; i<response[0].length; i+=1){
$scope.searchRef.push(
{
name: response[0][i].name || response[0][i].full_name,
symbol: response[0][i].short_name,
code: response[0][i].id,
market: $marketProvider[$scope.currentMarket].long
}
);
}
console.info($scope.searchRef);
$ionicLoading.hide();
}
);
}
HTML
<div class="list">
<div class="item" ng-repeat="item in searchItems" ng-click="openDetail(item)">
<p>{{item.symbol}} - {{item.name}}</p>
<p>{{currentMarket | uppercase}}</p>
</div>
</div>
? – Phil
@Phil編集済み.1行分 –