Friday, 15 February 2013

angular ng if - AngularJs ng-if comparing dates -



angular ng if - AngularJs ng-if comparing dates -

i looking compare 2 dates in ng-if jade file looks like.

li.list-group-item(ng-if="app.segments[0].startdate.gettime() > date.gettime()") div.row div.col-xs-12 span i.fa.fa-plus-square

this code add together li ui if startdate of first segment after today.

$scope.date = new date(); $scope.app = { segments: [{ startdate: 2014-11-15t04:00:00.000z enddate: 2014-11-20t04:00:00.000z }, { startdate: 2014-11-21t04:00:00.000z enddate: 2014-11-25t04:00:00.000z }] }

is there anyway create work?

if they're date object compare them straight without .gettime()

$scope.date2005 = new date('2005/01/01'); $scope.date2006 = new date('2006-01-01t04:00:00.000z'); <div ng-if="date2005 > date2006">date2005 > date2006</div> <!-- won't show --> <div ng-if="date2006 > date2005">date2006 > date2005</div> <!-- show -->

http://plnkr.co/edit/fnb11u6kmfszdv3lmapj?p=preview

angularjs angular-ng-if

No comments:

Post a Comment