我在 AngularJS 1.4.3 应用程序中使用过滤器。 我要做的是,如果 vm.nightServices 被过滤,则不会显示任何条目(因此所有条目都被过滤),而不是 div 容器应该被隐藏。我尝试过 ng-show="vm.nightServices.length > 0" 但它不起作用。
<div ng-show="vm.nightServices.length > 0" ng-repeat="nightService in vm.nightServices | filter:institutionOfUserFilter.institutionName">
最佳答案
您可以在 ng-repeat 中创建一个新的过滤列表,您可以在 ng-show 中检查其长度。
<div ng-repeat="nightService in filtered = ( vm.nightServices | filter:institutionOfUserFilter.institutionName )" ng-show="filtered.length > 0">
关于angularjs - 当所有条目都在 angularJS 中过滤时,如何隐藏容器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35839256/