0

I have an AngularJS express to display either a date or "NO" based on another property within the ng-repeat loop.

If requirement.MyStatus == "Y" then I want to display requirement.MyDate else if requirement.MyStatus == "N", display "NO"

<tr ng-repeat="requirement in listItems" ng-class="requirement | rowFilter">
                                <td ng-bind="requirement.MyStatus"></td>

                                <td ng-bind="requirement.MyDate | date:'shortDate'"></td> 

                            </tr>

I tried the following expression but it did not work

{{requirement.metStatus == "N" | iif : "requirement.MyDate | date:'shortDate'" : "NO" }}

Any help is appreciated.

Thanks.

2 Answers 2

1

Try this way:

{{requirement.metStatus == "N" ? (requirement.MyDate | date:'shortDate') : "NO" }}
Sign up to request clarification or add additional context in comments.

1 Comment

Role is reversed i think == should equate with 'Y'
0

Change this

<td ng-bind="requirement.MyDate | date:'shortDate'"></td>

to

<td ng-bind="requirement.MyDate | date:'shortDate'" ng-if="requirement.MyStatus == 'Y'"></td>

Comments

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.