0
私はリストを持っています。私はそれをapiから取得します。このリストにはサブリストがあります。サブリストにリストIDがあります。私は、親リストがクリックされたときに、APIからサブリストを取得して表示する必要があります。私はそれをどうやってできるの? これは私のリストです:anglejのidでリストを取得
function getType1() {
var deferred = $q.defer();
$http.get("http://mobile.unimax.kz/api/type1api")
.success(function (data) {
deferred.resolve(data);
$scope.type1 = data;
})
.error(function() {
deferred.reject();
});
}
getType1();
これはmysublistです:
$scope.getType2 = function (id) {
var deferred = $q.defer();
$http.get("http://mobile.unimax.kz/api/type2api/" + id)
.success(function (data) {
deferred.resolve(data);
console.log(data);
$scope.type2 = data;
$state.go('tab.catalog2', {
id: id
});
})
.error(function() {
deferred.reject();
});
}
これは私のリストを表示する方法を示します。
<ul class="list">
<li class="item item-icon-right" ng-repeat="type in type1" ng-click="getType2({{type.id}})">
<h4>{{type.type11}}</h4>
<i class="icon ion-chevron-right icon-accessory"></i>
</li>
</ul>
を使用するだけで、補間しようとしないでくださいダウンロードしてデータを返しました。 –
が表示されていない場合は、plunker/fiddleをデバッグするか提供する必要があります。 –