Conditional translated text inside button?


#1

Hi,

I have a button than contains “Continue” or “Save” text conditionally:

Is this the correct way to get this or there are a better way?

Important: Text must be translated using ng2-translate.

Thanks in advance.


#2

i would try ternary operator:

<button>
  {{ canGoBack ? ('Save'|translate) : ('Content'|translate) }}
</button>

i think a div inside of a button is invalid html :wink:


#3

Thank you @bengtler.

It works!