3

Button:

<input type="submit" value="{loading : 'please wait...', !loading : 'start'}" />

However this does not work. I get the expression as value instead of please wait/start. Is there a built in angular directive to do this?

2 Answers 2

3

Maybe you are looking something like

<input type="submit" value="{{loading && 'please wait...' || 'start'}}" />

It works like ternary operator.

And if you are using Angular 1.1.5 or above this would work

<input type="submit" value="{{loading ? 'please wait...' : 'start'}}" />
Sign up to request clarification or add additional context in comments.

Comments

1

This may be old, but I thought I'd add this answer for button specific tag, since setting the value of button wasn't working for me. I needed to add this as follows.

<button type="button" ng-click="actionAll();" 
             class="btn btn-default">{{loading ? 'please wait...' : 'start'}}</button>

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.