[软件设计/软件工程] AngularJS 只显示某些类别

[复制链接]
发表于 2022-5-6 16:01:12
问题
我认为这是一个长镜头,但希望有人能帮助我,下面是我认为我得到所有类别的部分,但我只想显示某些类别,而不是所有类别。在图像中,我有完整的分类,但我希望材料部分不出现,但在后台仍然具有搜索功能
  1. <div class="ng-cloak" ng-app="angularDemo" ng-cloak="">
  2.   <div ng-controller="angularController as ctrl">
  3.     <div class="hidden-xs" id="filter_desktop" layout="row">
  4.       <div class="container">
  5.         <div class="col-sm-2" style="padding-left: 0px;margin-left: -47px;margin-right: 46px;">  
  6.           <div class="filter" style="color: #999;font-weight: 100;font-size: 120%;margin-right: -60px;"><span>FILTER YOUR SEARCH</span></div>

  7.           <div class="resetFilter">
  8.             <center class="text-left" style="color: #999;"><button id="resetFilter" onclick="window.location.href='" type="button"><img alt="" src="/Data/Sites/1/media/collection/reset-icon-614x460.png" style="height: 30px!important;" />RESET FILTERS</button></center>
  9.           </div>

  10.           <div class="sidebar" style="border-top: 1px solid #c1c1c1;">
  11.             <div ng-repeat="filter in Filters" style="border-bottom: 1px solid #c1c1c1;">
  12.               <div class="col-sm-1" style="margin-right: -30px;"><button ng-click="filter.expanded = false" ng-if="filter.expanded" style="margin-left: 140px; background-color: transparent;border: none;font-size: 25px;margin-top: -34px;">+</button><button ng-click="filter.expanded = true" ng-if="!filter.expanded"
  13.                   style="margin-left: 140px;background-color: transparent;border: none;font-size: 45px;margin-top: -34px;">-</button></div>

  14.               <h3 class="sort" style="font-size: 18px;font-weight: 100;text-transform: uppercase;margin-bottom: 15px;">{{filter.name}}</h3>

  15.               <div class="sortoptions" style="margin-bottom: 15px;">
  16.                 <div data-hidden-checkbox="{{ filter.name == 'family'}}" ng-if="!filter.expanded" ng-repeat="option in filter.options | orderBy: 'value'" style="line-height: 1.6;"><input id="{{option.value}}" ng-checked="option.IsIncluded" ng-model="option.IsIncluded" style="margin-bottom: -1px!important;" type="checkbox" /> <label for="{{option.value}}">{{option.value}}</label></div>
  17.               </div>
  18.             </div>
  19.           </div>
  20.         </div>
复制代码

回答
在 codepen 示例中,只需添加

ng-if="filter.name !== 'color'"

遍历此处的过滤器列表( ng-repeat )。仅当过滤器的名称不是颜色时才会呈现 div。

这是最新的密码笔。





上一篇:如何在 ASP.NET Core 中启用 CORS
下一篇:在jQuery中获取复选框值

使用道具 举报

Archiver|手机版|小黑屋|吾爱开源 |网站地图

Copyright 2011 - 2012 Lnqq.NET.All Rights Reserved( ICP备案粤ICP备14042591号-1粤ICP14042591号 )

关于本站 - 版权申明 - 侵删联系 - Ln Studio! - 广告联系

本站资源来自互联网,仅供用户测试使用,相关版权归原作者所有

快速回复 返回顶部 返回列表