Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

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.

share|improve this question
    
I would compare the values in the controller, then use a single, simple binding –  Sprottenwels Jul 12 '13 at 9:02

1 Answer 1

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.

share|improve this answer
    
Can you please explain a little bit more. A proper syntax would be really helpful. Thanks –  Palash Debnath Jul 12 '13 at 9:07
    
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. –  Jeff Foster Jul 12 '13 at 9:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.