<span class="diff curls" ng-if="{diffInMiliseconds > 60000}"> ( + </span> 

Error> unexpected token

Probably it is necessary to shield this symbol so that the condition fulfills or in ng-if it is not possible to set comparison conditions at all?

  • What is the meaning of curly braces here? - Grundy
  • I thought it was an expression. Not needed? I'm just a newbie. - Elina
  • Yes, they are not needed. - Grundy
  • there is no mistake without them, but it doesn’t work out - Elina
  • Why do you think that does not work? - Grundy

2 answers 2

The expression for ng-if must be a valid angular expression, otherwise a parse error will be generated.

In this case, curly braces are redundant, if you remove the expression will be correct.

Example:

 angular.module('app', []); 
 <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.6/angular.js"></script> <div ng-app="app" ng-init="diffInMiliseconds=60001"> <span class="diff curls" ng-if="diffInMiliseconds > 60000"> ( + </span> <span class="diff curls" ng-if="diffInMiliseconds <= 60000"> removed </span> </div> 

  • found the answer - the wrong condition - Elina
  • @Elina, well, in any case, curly braces were redundant. You edit your answer by adding a description of what has changed and how, or delete it, as it is now weakly related to the question asked. - Grundy
 <span class="diff" ng-if="row.days != 0 || row.hours != 0 || row.minutes != 0">( + <span class="diff" ng-if="row.days">{{row.days}} д.</span> <span class="diff" ng-if="row.hours">{{row.hours}} ч.</span> <span class="diff" ng-if="row.minutes">{{row.minutes}} м.</span> ) </span> 
  • one
    if you have a new question - ask it separately, if this is a clarification for this question - edit the current one. - Grundy