我从AngularJS文档中获取了一些示例代码,这允许对多个字段类型进行基本过滤。如何为此添加日期范围?我已尝试在{}中添加多个条件,但这不起作用。
示例代码
<div ng-init="friends = [{name:'John', phone:'555-1276', date:'2015-05-12'},
{name:'Mary', phone:'800-BIG-MARY', date:'2014-02-24'},
{name:'Mike', phone:'555-4321', date:'2013-08-03'},
{name:'Adam', phone:'555-5678', date:'2015-03-16'},
{name:'Julie', phone:'555-8765', date:'2014-12-27'},
{name:'Juliette', phone:'555-5678', date:'2011-01-19'}]">
</div>
<label>Any: <input ng-model="search.$"></label> <br>
<label>Name only <input ng-model="search.name"></label><br>
<label>Phone only <input ng-model="search.phone"></label><br>
<!-- I've added this START-->
<label>Date between<input ng-model="search.dateFrom"></label><br>
<label>and<input ng-model="search.dateTo"></label><br>
<!-- END -->
<table id="searchObjResults">
<tr><th>Name</th><th>Phone</th></tr>
<tr ng-repeat="friendObj in friends | filter:search">
<td>{{friendObj.name}}</td>
<td>{{friendObj.phone}}</td>
</tr>
</table>
我在ng-repeat过滤器上省略了任何日期范围逻辑。