angularinnerhtmlangular-translate

Proper values for innerHTML and translate Angular


In translate json i have something like this

"Take": "The '<b>{{Name}}</b>' is assigned to user <b>{{user}}</b> until <b>{{Date}}</b>"

But when i try something like this in html

<p [innerHTML]="'Take' | translate: '{ Name: options.Name, user: options.user, Date: options.date }'">
</p>

And object

options = {
Name: John,
user: Rambo,
Date: 22/02/1997
}

I got this error ERROR SyntaxError: Wrong parameter in TranslatePipe. Expected a valid Object, received: I dont know where I am taking this wrong?


Solution

  • translate: '{ Name: options.Name, user: options.user, Date: options.date }'
    

    Means your sending a string.

    Try with

    translate: { Name: options.Name, user: options.user, Date: options.date }