这就是我上市的方式。
result = (input + pad).substring(0, pad.length());
results: "******" | "abcd**" | "abcdef"
我有另一个功能,我想用于过滤器:它看起来像下面。
$scope.events = [];
$scope.groupevent = [];
Event.getList().then(function(data){
$scope.events = data.events;
$rootScope.events = data.events;
angular.forEach($scope.events,function(value,key){
value.groupdate = value.startDate.substring(0,7)+'-01';
console.log(value.groupdate);
});
$scope.events = _.orderBy($scope.events, ['startDate'], ['asc']);
$scope.groupevent = _.groupBy($scope.events,'groupdate');
console.log($scope.groupevent);
});
但是当我$scope.greaterThan = function(){
var prop='endDate';
var val=Date.now();
return function(item){
return new Date(item[prop]) > val;
}
};
时:
ng-repeat
它说:ng-repeat="(key,x) in groupevent | filter:greaterThan()"