How to Concatenate pipe value in a sting

53 Views Asked by At

I am trying to Concatenate date value in a string. But it is not working. If anyone knows please help to resolve this issue.

HTML:

<img src="assets/images/icon.png [tooltip]="'First Date +new Date() | date:'dd/mm/yyyy hh:mm:ss+'">
1

There are 1 best solutions below

0
achillezz On

You can't call a Date object constructor inside html in Angular and assign it to the @Input(). You need to close the [src] tag and you can assign the date form the typescript file.

protected currentDate = new Date();

<img src="assets/images/icon.png" [tooltip]="'First Date '.concat(currentDate | date)">

Also consider doing everything in the .ts and just assigning it as a property here.