0
我有一个我从json获取的文本,并且我想要更改文字上出现的某些单词的颜色,例如recusada
。我创建了一个管道,试图做到这一点:更改特定单词的颜色
transform(valor:any):any{
console.log("texto", valor);
return valor.replace(/recusada/, '<span style="color: red">$&</span>');
}
这是HTML:
<p *ngFor="let historico of disputa.historico"> {{historico.texto | filtroHistorico: historico.texto}} </p>
唯一的问题是,而不是仅仅改变recusada
颜色为红色的文字是这样的:
Proposta无勇气去R $:5762
<span style="color: red">recusada</span>
哇,没现在有像'innerHtml'这样的属性,非常感谢你的人:) –