Reputation: 1994
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
Upvotes: 16
Views: 60962
Reputation: 31
You can also try this, it works!
<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js">
</script>
<body>
<div ng-app="">
10<20 : {{10<20}}
</div>
</body>
</html>
Upvotes: 3
Reputation: 37
You can use like this.
{{ data[0].Insight_Value_2 <= 15 ?data[0].Insight_Value_2 : data[0].Insight_Value_2/2 }}
It works.
Upvotes: 0
Reputation: 364707
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>
Upvotes: 26