Comparing dates using AngularJS in ng-if

I have 2 dates:

$scope.date = new Date();

And the date from the array, which looks like this:

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

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

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

However, this will not work. Any problems?

+4
source share
1 answer

no problem, only you forget to take the brackets ...
see this plunker ....

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

Source: https://habr.com/ru/post/1605910/


All Articles