4
<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

2 Answers 2

5

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.

Sign up to request clarification or add additional context in comments.

Comments

2

Use ng-bind and ng-if. Like this:

<span ng-bind="a.value" ng-if="a.value"></span>

1 Comment

Then it will be <div ng-bind="a.value | number:0" ng-if="a.value"></div>. This is good!

Your Answer

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.

Ask question

Explore related questions

See similar questions with these tags.