我想翻译一个包含<a>
标签的源文本,带有url
参数,字符串文本示例:
STRING_TEXT = 'some text <a href={{url}}>some link name</a>'
我知道那里可以翻译
<div [innerHTML]="'STRING_TEXT' | translate"></div>
如文档中所述。
但是在这种情况下,我如何包含url
参数?
translate
管道采用参数对象,该对象是翻译消息的上下文,您可以将此参数传递为:
<div [innerHTML]="'STRING_TEXT' | translate: {url: someVariableOnComponent}"></div>
查看文档