Yashpal Singla Yashpal Singla - 25 days ago 10
AngularJS Question

How to make less than or greater than comparison in angularjs

Please anybody explain how to do below check in angularjs

<div ng-show="{{offset <= 10}}">Show Me</div>


If i run it like this it breaks the html, i think due to "<" than in comparison

Answer

Don't use {{}}s:

<div ng-show="offset <= 10">Show Me</div>

The expression given to ng-show is evaluated against the current scope, so there is no need for interpolation – the {{}}s.

You would need the {{}}s if you wanted to do something like this:

<div>Offset is <= 10: {{offset <= 10}}</div>
Comments