Yashpal Singla Yashpal Singla - 1 year ago 84
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 Source

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>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download