Javascript 如何在angularjs上根据日历中选定的日期筛选表元素
使用MEANSTACK技术,我遇到了以下情况: 一个输入标记,类型为“date”,如下所示:Javascript 如何在angularjs上根据日历中选定的日期筛选表元素,javascript,angularjs,mean-stack,Javascript,Angularjs,Mean Stack,使用MEANSTACK技术,我遇到了以下情况: 一个输入标记,类型为“date”,如下所示: <input class="form-control form-control-lg" style="margin-left:5px;" type="date" ng-model="myObject.locations[0].timestamp"> <table class="table table-striped"> <th
<input class="form-control form-control-lg" style="margin-left:5px;" type="date" ng-model="myObject.locations[0].timestamp">
<table class="table table-striped">
<thead>
<tr>
<th class="col-xs-4">Date</th>
<th class="col-xs-4">Address </th>
</tr>
</thead>
<tbody>
<tr ng-repeat="obj in history" >
<td class="col-xs-4">{{obj.locations[0].timestamp | date: "dd-MM-yyyy-HH:mm:ss" }}</td>
<td class="col-xs-4">{{addr}}</td>
<td class="col-xs-4">{{obj.locations[1].timestamp | date: "dd-MM-yyyy-HH:mm:ss" }}</td>
<td class="col-xs-4">{{addr}}</td>
</tr>
</tbody>
</table>
myObject:{
"p0":"value0",
"p1":"value1",
locations:[
{"long":"vlong0",
"lat":"vlat0",
"timestamp":"vtimestamp0"},
{"long":"vlong0",
"lat":"vlat0",
"timestamp":"vtimestamp0"}]
}
这是我在控制器中填充表格的方式:
$http.get('myobject.json').success(function(response){
$scope.history = response;
});
问题是我找不到根据日历日期选择筛选表的方法,也找不到如何在整个“位置”数组中进行筛选的方法。我该怎么办。任何帮助 在ng repeat=“obj in history |”中使用自定义过滤器对象中的
timestamp
属性只是一个字符串,而不是日期