Conditional translated text inside button?

Hi,

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

image

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.

1 Like

i would try ternary operator:

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

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

2 Likes

Thank you @bengtler.

It works!