1
私が作成しているIonicアプリに問題があります。角型/イオン型ng-if
特定の画面では、アプリケーションは1つ以上の名前を表示し、divのng-repeatディレクティブを使用します。 divにはselect要素もあります。 select要素の値に基づいて、別のsub-divを表示または非表示にしたいと思います。これは私がこれまで持っているものです。
$scope.data = {};
$scope.data.customerList = {};
$scope.data.serviceTypes = ['', 'Personal', 'Non-Personal'];
$http.get(ApiEndpoint.url + '/GetJobDetails?id=' + $scope.jobId).then(function(resp) {
for (i = 0; i < resp.data.Customers.length; i++) {
var newCustomer =
{
"CustomerName": resp.data.Customers[i].CustomerName,
"SubjectId": resp.data.Customers[i].SubjectId,
"Served": false,
"ServiceType": ""
};
$scope.data.customerList[i] = newCustomer;
}
}, function(err) {
});
私が何をしようとしているのdivを表示している:
<div ng-if="customer.ServiceType == 'Non Personal'">
<p>Div Stuff to Display Here</p>
</div>
<ion-list>
<div class="item item-input item-select" ng-repeat="customer in data.customerList">
<ion-checkbox class="checkbox-balanced" style="border:none;" ng-click="onCheckboxClick($event, customer.SubjectId)"></ion-checkbox>
<div class="input-label item-text-wrap">{{customer.CustomerName}}</div>
<select ng-model="customer.ServiceType" ng-options="o as o for o in data.serviceTypes" ng-disabled="customer.Served == false"></select>
<div ng-if="customer.ServiceType == 'Non Personal'">
<p>Div Stuff to Display Here</p>
</div>
</div>
</ion-list>
そしてここでは、コントローラから取得したデータがどのようです
選択値が 'Non Personal'の場合。現在、選択値が変更されても何も起こりません。私はng-ifをng-showに交換しようとしましたが、同じ結果が発生しました。
誰でも手助けできますか?あなたが代わりに{{o}}
に値を設定する必要が
感謝を使用することができます!治療をしました! –