Zaif Warm Zaif Warm - 2 months ago 13
AngularJS Question

How to show angularjs expression in ternary operator?

actually i want to show angularjs expression in ternary operator,Is it possible to show expression in ternary operator if yes then can some one guide me.Thanks in advance.

This is what i have tried but its not work.

{{ jdFile ? "Job Description File : {{fileName}}" : "Resume File :{{fileName}}" }}

{{ jdFile ? "Job Description File : '[fileName]'" : "Resume File :'[fileName]'" }}

{{ jdFile ? "Job Description File : 'fileName'" : "Resume File :'fileName'" }}


Where jdFile is a Boolean value and fileName is a expression.

Answer Source

use: {{ jdFile ? "Job Description File" : "Resume File" }} {{fileName}}

toggle the text on the basis of your jdFile flag, and your fileName variable is used in both so place it at the end.