Javascript 如何使用$watch使用angularjs bootstrap搜索上周

Javascript 如何使用$watch使用angularjs bootstrap搜索上周,javascript,angularjs,Javascript,Angularjs,我认为你需要更具体的格式 或者尝试转换时间戳中的所有内容 差不多 {{1288323623006 |日期:'MM/dd/yyyy@h:mma'} <a href="" ng-click="(search.order_date>=30/11/2016)">Last 7 days</a> <tr ng-repeat="item in filtered = items | filter:search | startFrom:(currentPage-1)*ent

我认为你需要更具体的格式 或者尝试转换时间戳中的所有内容 差不多

{{1288323623006 |日期:'MM/dd/yyyy@h:mma'}

<a href="" ng-click="(search.order_date>=30/11/2016)">Last 7 days</a>

<tr ng-repeat="item in filtered = items | filter:search | startFrom:(currentPage-1)*entryLimit | limitTo:entryLimit">
 var app = angular.module('myApp', ['ui.bootstrap']);
    app.filter('startFrom', function () { 
   return function (input, start)
    { 
       if (input) { 
               start = +start; 
               return input.slice(start); 
        } 
          return [];
    };
});


 app.controller('PageCtrl', ['$scope', 'filterFilter', function ($scope, filterFilter) {
$scope.items = [
                {"orderid":1,"skuid":"SKU0010","productimage":"image1","productname":"box","quantity":"1","productprice":"70","totalprice":"100","channelname":"Amazon","order_date":"30/01/2017"}, 
                {"orderid":2,"skuid":"SKU02","productimage":"image2","productname":"box2","quantity":"1","productprice":"700","totalprice":"1000","channelname":"flipkart","order_date":new Date("30/01/2017")}
               ];

// create empty search model (object) to trigger $watch on update
$scope.search = {};

$scope.resetFilters = function () {
    // needs to be a function or it won't trigger a $watch
    $scope.search = {};

};
/*$scope.pastFilters = function () {
    // needs to be a function or it won't trigger a $watch
    //$scope.search = {};


    alert("past");
};*/

// pagination controls
$scope.currentPage = 1;
$scope.totalItems = $scope.items.length;
$scope.entryLimit = 8; // items per page
$scope.noOfPages = Math.ceil($scope.totalItems / $scope.entryLimit);

// $watch search to update pagination
$scope.$watch('search', function (newVal, oldVal) {
    //alert(newVal);
    $scope.filtered = filterFilter($scope.items, newVal);
    $scope.totalItems = $scope.filtered.length;
    $scope.noOfPages = Math.ceil($scope.totalItems / $scope.entryLimit);
    $scope.currentPage = 1;
}, true);


}]);