过滤模型angularjs

时间:2015-09-24 10:55:30

标签: html angularjs

我有这样的模特:

[{
  "TaskDate": "2015-01-04T00:00:00",
  "TimesheetList": [{
    "WorkItemId": 24,
    "ProjectId": 13,
    "ProjectName": "My Project",
    "UserId": 12,
    "UserName": "Some User",
    "Date": "2015-01-04T22:00:00",
    "Task": "Some text",
    "TimeWorked": 2.0,
    "Note": null
  }]
}]

这个数据视图在表格中,我需要按用户和日期(从 - 到)添加过滤器 怎么做角度? 我将我的示例添加到PLUNKER

1 个答案:

答案 0 :(得分:0)

您可以在控制器示例中创建一个函数:

$scope.filterFN = function(model){

          //here check for the userid and date range
          //return true or false

};

在你的HTML中......

ng-repeat="model in models | filter: filterFN"