0

I want to display a button depending on the result of ternary operator in Angular JS, but I am not able to display the HTML content inside the curly braces, it only allows the string form. Below is my code.

{{x.status === "pending" ? "pending" : "Card is Already Verified"}}
<ons-button ng-click="setCard(x); page.pushPage('verifyCard.html', {animation: 'slide'});">Verify <ons-icon icon="ion-checkmark"></ons-button>

If the status is pending, I want to display the ons-button in pending field.

1
  • you can use ng-show ='x.status==="pending"' in ons-button Commented Feb 24, 2016 at 7:14

2 Answers 2

2

Can you try

<ons-button ng-show='x.status === "pending"' ng-click="setCard(x); page.pushPage('verifyCard.html', {animation: 'slide'});">Verify <ons-icon icon="ion-checkmark"></ons-button>

ng-show documentation here

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

Comments

0

You can use ng-show directive to show/hide the button. For example

<ons-button ng-show="condition">

In place of condition you need to place the valid condtion. If that condition is true then the button will be shown, else button will be hidden.

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.