simbada
simbada

Reputation: 980

angular conditional title with static text before expression

I am trying to have title conditionally but not sure how i can add some static text with else expression

In my code, both myTooltip and displayName are angular expressions. This work fine.

However, what if i want to append static text i.e. Mr before displayName. how can i do that?

title="{{(dataAvaialble ? myTooltip : displayName)}}"

I could wrote like this but it gives error

title="{{(dataAvaialble ? myTooltip : 'Mr' displayName)}}"

Upvotes: 0

Views: 1375

Answers (1)

MarcoS
MarcoS

Reputation: 17721

This should work:

ng-attr-title="{{ dataAvaialble ? myTooltip : 'Mr' + displayName }}

Upvotes: 1

Related Questions