Laurynas
Laurynas

Reputation: 1032

AngularJS date comparison in ng-if

I have 2 dates:

$scope.date = new Date();

And date from array which looks like this:

visits[1].when = "2015-09-05T10:00:00+0300";

Using AngularJS ng-if method I want to compare if this date is today:

ng-if="date | date:'d M' == visit.when | date:'d M'"

However, it does not work. Any issues?

Upvotes: 4

Views: 3750

Answers (1)

Sandeep
Sandeep

Reputation: 1479

not any issue only you forget to take brackets...
see this plunker....

 <p ng-if="(date | date:'d M') == (when | date:'d M')">hi date</p>

Upvotes: 5

Related Questions