1
我想提出一條消息,說如果列表中不包含任何內容,則該列表爲空。如果我的表格爲空,我希望它顯示「無組」或「無分類」等消息。如果angularjs中的數組爲空,則顯示一條消息
我的代碼:
<ion-list>
<ion-item class="item-stable" ng-click="toggleGroup(group)" ng-class="{active: isGroupShown(group)}">
<i class="icon" ng-class="isGroupShown(group) ? 'ion-minus' : 'ion-plus'"></i>
Group 1 :
</ion-item>
<ion-item class="item-accordion" ng-repeat="item in group track by $index" ng-show="isGroupShown(group)">
{{item.groupName}}
</ion-item>
</ion-list>
<div class="spacer" style="width: 283.2px; height: 10px;"></div>
<ion-list>
<ion-item class="item-stable" ng-click="toggleGroup(group)" ng-class="{active: isGroupShown(group)}">
<i class="icon" ng-class="isGroupShown(group) ? 'ion-minus' : 'ion-plus'"></i>
Category :
</ion-item>
<ion-item class="item-accordion" ng-repeat="item in category track by $index" ng-show="isGroupShown(group)">
{{item.categoryName}}
</ion-item>
</ion-list>
在我的控制器
:
$scope.group = [];
$scope.toggleGroup = function(group) {
if ($scope.isGroupShown(group)) {
$scope.shownGroup = null;
} else {
$scope.shownGroup = group;
}
};
謝謝:)