我想篩選日期並僅顯示當前日期和隱藏未來日期的日期。這裏是我的html代碼:日期篩選和在angular.js中顯示
<div ng-controller="date">
<div ng-repeat="d in dates">
<ul>
<div ng-show='(show==true)' ng-hide='(show==false)'><li>{{d.thisDate() | date:"mediumDate"}}</li></div>
</ul>
</div>
</div>
這裏是我angular.js代碼:
var milo = angular.module('milo',[]);
function date($scope){
$scope.dates = [
{
id: 0,
thisDate: function(){
return new Date();
}
},
{
id: 1,
thisDate: function(){
return new Date();
}
},
{
id: 2,
thisDate: function(){
return 141232741945463;
}
},
];
$scope.show = function(){
if (thisDate == new Date()){
return true;
}
else if (thisDate > new Date()){
return false;
}
};
};
milo.controller('date', date);
預先感謝幫助我。
謝謝,我會繼續這一點,但現在它不幫助我:/ – newport 2014-10-02 11:07:54