Answers for "html special characters decode angular"

0

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));
Posted by: Guest on January-30-2021

Code answers related to "html special characters decode angular"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language