Is there any way to use html tags in an interpolation?

Asked

Viewed 177 times

1

I have a component that calls a confirmation dialog, I pass to the dialog the title and the description of the dialog in this way:

const dialogRef = this.dialog.open(ModalConfirmacaoGeral, { data: {tituloDialog: "Titulo do dialog de confirmacao", descricaoDialog: "Tags html dentro da interpolação<br>, testeeeee"}, panelClass: 'dialogpanel' })

In the dialog I receive this data and show in the template through interpolation:

<h5 class="tituloDialog"><strong>{{data.tituloDialog}}</strong></h5>

<p>{{data.descricaoDialog}}</p>

The <br> are being shown as part of the sentence instead of performing line break. Is it possible to use literal template that way? How can I do pro <br> work? Thank you

1 answer

0


I managed to solve it that way:

<p [innerHTML]="data.descricaoDialog"></p>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.