html special characters decode angular code example

Example: html special characters decode angular

// this function remove all html tags in text
  extratHtmlTags(content) {
        return content.replace(/<[^>]*>/g, '');
    }
          
   // this function decode  html special characters in text
  decodeSpecialEntitiesHtml(htmlentities) {
    const str = document.createElement("textarea");
    str.innerHTML = htmlentities;
    return str.value;
  }
    // this function conver all html tags and special characters  to simple text        
  htmlEntitiesdecode(html){
     return this.extratHtmlTags(this.decodeSpecialEntitiesHtml(html) );
  }

          // Exemple
  const html = '<label for="target">My name is Pierre Yem Mback: Autres questions posées sur le syst&egraveme ? :</label>';

    console.log(this.extratHtmlTags(this.html));
    console.log(this.decodeSpecialEntitiesHtml(this.html));
    console.log(this.htmlEntitiesdecode(this.html));