Date Pipe Formatting Issue

  angular, html, pipe, typescript

I am attempting to format my date, however I am having issues with the pipe inside of a ternary operator. Any assistance would be greatly appreciated.

I want to use a ternary operator to say if its true then show the formatted date and if not then show the my na message. This first line formats just fine but as soon as I introduce a ternary operator it does not. I think I am writing it incorrectly.

[innerHTML]="myBundle.myDate | date: 'MMM/dd/yyyy'"

I want it to look like this. Where am I going wrong with this line?

[innerHTML]="myBundle.myDate | date: 'MMM/dd/yyyy' ? myBundle.myDate | date: 'MMM/dd/yyyy': na | fdContent"

Source: Angular Questions

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.