is it possible to hide the <select>
element if the ng-options
variables are empty after using a filter?
<select class="form-control"
ng-model="selected"
ng-options="property.pstSnr.description for property in leistobToProperties | filter: {grouping:1}">
</select>
The <select>
element should not be visible if all the options of property.pstSnr.description
are empty.
Thanks.
You can define your filtered list and then use it in an ng-show
:
<select class="form-control"
ng-show="filteredSet"
ng-model="selected"
ng-options="property.pstSnr.description for property in filteredSet = (leistobToProperties | filter: filtering)">
</select>
也许
<select class="form-control" ng-model="selected" ng-show="filtered.pstSnr.description.length > 0" ng-options="property.pstSnr.description for property in filtered = (leistobToProperties | filter: {grouping:1})"></select>
I have a select as well hidden if there are no options
<select id="categorylist" focus-on="focusMe" ng-change="UpdateDowntimeEvent()" class="col-md-11" name="CategoryId" ng-model="Model.CurrentDowntime.CategoryId" ng-options="downtimeCategory.CategoryId as downtimeCategory.CategoryName group by downtimeCategory.Node for downtimeCategory in Model.DowntimeCategories" required="" ng-hide="Model.DowntimeCategories ==0" >
You can try this
<select class="form-control" ng-model="selected" ng-options="property.pstSnr.description for property in leistobToProperties | filter: {grouping:1}" ng-hide=" property.leistobToProperties == 0"></select>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.