Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
<div>{{a.value | number:0}}</div>
this is what I have. I would like to display just "" if the value is 0. Anyway I can do that within the same line? or I have to filter it out in a controller.
Thanks
Pretty ugly but you can do it like this:
<div>{{a.value ? (a.value | number:0) : '' }}</div>
Not sure if there is more clearer way though.
Add a comment
Use ng-bind and ng-if. Like this:
ng-bind
ng-if
<span ng-bind="a.value" ng-if="a.value"></span>
<div ng-bind="a.value | number:0" ng-if="a.value"></div>
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.