作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在我的约会数据中,我有几个月、几周、几天、时间段
在 ListView 中显示“周”并不重要(但对于其他报告很重要)
对于“天数”,我可以过滤掉没有约会的天数:
<div ng-repeat="month in appointments.months: | filter:{????:''}">
<div>{{month.name}}</div>
<div ng-repeat="week in month.weeks"> <!--Not displaying anything for weeks-->
<div ng-repeat="day in weeks.days | filter:{timeslots:''}">
....</div></div></div>
filter:{timeslots:''} 具有抑制没有约会的天数的预期效果。
我还想取消显示没有约会的月份。我尝试了 |filter:{weeks.days.timeslots:''} 的变体,但没有成功。
是否有直接的(内置的)方法来对 angularjs 中的值进行深度过滤,或者我是否必须为此构建自定义过滤器?
最佳答案
是的,有一种方法存在!!!
A special property name
$
can be used (as in {$:"text"}) to accept a match against any property of the object or its nested object properties.
The predicate can be negated by prefixing the string with !. For example {name: "!M"} predicate will return an array of items which have property name not containing "M".
这是 filter解释。
关于javascript - AngularJs ng-repeat 通过更深层次的数据进行过滤,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37255220/
我是一名优秀的程序员,十分优秀!