input element not displayed when html is built on string

Discussão em 'Angular' iniciado por ucef, Junho 23, 2025.

  1. ucef

    ucef Guest

    i built an html inside string variable like this :

    sanitizer.bypassSecurityTrustHtml(
    "Nom de l'élève: " +
    document.eleveNom +
    '</br>' +
    "Prénom de l'élève: " +
    document.elevePrenom +
    '</br>' +
    (document.niveauLib ? 'Niveau : ' + document.niveauLib + '</br>' : '') +
    (document.serieLib ? 'Série : ' + document.serieLib + '</br>' : '') +
    (document.produitLib ? 'Solution : ' + document.produitLib + '</br>' : '') +
    (document.datePremierCoursSouhaitee
    ? 'Date 1er cours souhaitée : ' + this.datePipe.transform(new Date(document.datePremierCoursSouhaitee), 'shortDate') + '</br>'
    : '') +
    '<a href="../famille/' +
    document.familleId +
    '/eleve/' +
    document.eleveId +
    '" target="_blank">Accéder Elève</a> </br>' +

    (isRechercheFromEnseignant
    ? "<input class='fake-chip " +
    (isSelected ? 'selected' : 'unselected') +
    "' type='button'id='prestationButton_" +
    document.id +
    "' value='Sélectionner'/>"
    : ''),
    ) as string;


    why when i don't use sanitizer.bypassSecurityTrustHtml i can't see an input element (), and i can see other element like and . with the same html, when using sanitizer.bypassSecurityTrustHtml, i see a input button

    Continue reading...

Compartilhe esta Página