在我的约会数据中,我有几个月、几周、几天、时段
在 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-通过更深层次的数据重复过滤,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37255220/