1
我找到了这个过滤器,我试图编辑它,让你选择一个选项,然后它灰色的另一个选项例如,如果你选择(蔬菜),你只能选择(橙)。AngularJs过滤器隐藏选项,如果没有产品
我不知道如何将它转换成代码,但我的逻辑。在dynamicFilter函数需要更新过滤器选项计数,如果它少于1需要添加一个类或其他东西。
这是我的代码笔任何帮助将是可怕的。
https://codepen.io/natedog213/pen/mwPxmy
<div ng-app='angularDemo' ng-cloak>
<md-toolbar layout-padding>
<h2>Filtering with Angular Filters</h2>
</md-toolbar>
<div layout="row" ng-controller="angularController as ctrl">
<div flex="20" class="sidebar" layout-padding>
<!-- Repeat the filter types and there options -->
<div ng-repeat="filter in Filters">
<h3>{{filter.name}}</h3>
<ul class="filteroptions">
<li ng-repeat="option in filter.options">
<input id="{{option.value}}" class="filter_option" type="checkbox" data-name="{{option.value}}" ng-model="option.IsIncluded" ng-checked="option.IsIncluded">
<label for="{{option.value}}">{{option.value}}</label>
</li>
</ul>
</div>
</div>
<div flex="50" layout="row">
<div flex ng-repeat="product in products | dynamicFilter:Filters:this" class="product">
{{product.name}}
</div>
</div>
</div>
</div>