1

How to Compare value while printing with AngularJS.

Like {{campaignOverview.TotalMailSent | number} > 0 }

Al i want to do is to compare the Total mail sent with 0 and the print "N/A" if 0 else the value it self.

Thanks in advance.

1
  • I would compare the values in the controller, then use a single, simple binding Commented Jul 12, 2013 at 9:02

1 Answer 1

2

You can pass parameters to your filter with the : symbol

{{campaignOverview.TotalMailSent | number:0}}

number would then be a filter that performs your formatting logic of "N/A" if zero, or otherwise self.

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

2 Comments

Can you please explain a little bit more. A proper syntax would be really helpful. Thanks
For filters in general (the | indicates a filter) then the documentation on Creating a Filter (docs.angularjs.org/guide/…) is probably the best place to start.

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.