显示条件AngluarJS的数据计数表

时间:2016-10-31 14:19:14

标签: html angularjs angularjs-scope angularjs-ng-repeat angularjs-filter

我正在尝试创建如下表格:

天数 超过3天3 超过20天4 超过30天5

所以我回来了3天以上的事情总数等。 问题1:如果我使用Ng-repeat我不能指定我的行标题(即第1列) 问题2:我的数据没有通过

请在下面找到我的代码片段:

我的控制器:

$scope.requests = requests;

function daysBetween(modifiedDate) {
  var currentDate = new Date();
  modifiedDate = new Date(modifiedDate);
  return UtilityFactory.getNumberOfDaysBetween(currentDate, modifiedDate);
}

 $scope.numberOfDaysSince = function(modifiedDate) {
          var days = daysBetween(modifiedDate);
          if(days === 1) {
            return '(1 day)';
          } else {
            return '(' + days + ' days)';
          }
        };

我的index.html

 <table class="table table-condensed" st-safe-src="requests" st-table="requestsCollection">
                <thead>
                    <tr>
                        <th>Number Of days</th>
                        <th>Total Count</th>

                    </tr>
                </thead>
                <tbody>
                <tr ng-repeat="request in requestsCollection ">
                    <td>Over 3 days</td>
                    <td>column 2
                    <span ng-repeat="requestCollection in requestsColl| filter: numberOfDaysSince(ticket.Modified) > 3">
                                {{requestsColl.length}}
                            </span>
                                        {{requestsColl.length}}
                                    </span>
                        </td>

                    <td>Over 20 days</td>
                    <td>
                            <span ng-repeat="requestCollection in requestsColl| filter: numberOfDaysSince(ticket.Modified) > 20">
                                {{requestsColl.length}}
                            </span>
                    </td>

                    <td>Over 30 days</td>
                    <td>
                            <span ng-repeat="requestCollection in requestsColl| filter: numberOfDaysSince(ticket.Modified) > 30">
                                {{requestsColl.length}}
                            </span>
                    </td>

                    <td>Total</td>
                    <td>                            
                                {{requestsCollection.length}}
                    </td>
                    <td></td>
                </tr>
                </tbody>

            </table>

0 个答案:

没有答案