Friday, May 17, 2024
 Popular · Latest · Hot · Upcoming
64
rated 0 times [  66] [ 2]  / answers: 1 / hits: 73856  / 11 Years ago, wed, january 29, 2014, 12:00:00

What is a simple way to change the text in a button element based on a boolean value?



pseudo code:



<button> some text OR some other text </button>


I read this: Angularjs if-then-else construction in expression



and this regarding ng-switch: http://docs.angularjs.org/api/ng.directive:ngSwitch



Neither seems to work using bool value from model


More From » angularjs

 Answers
33

Should use like that :



<button> {{ cond_vall == true ? 'Case 1' : 'Case 2' }}</button>

[#72858] Tuesday, January 28, 2014, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
rhettforrestm

Total Points: 468
Total Questions: 106
Total Answers: 88

Location: Finland
Member since Sat, Nov 6, 2021
3 Years ago
;