Currently I'm using
htmlToText(html: string) {
const tmp = document.createElement('DIV');
tmp.innerHTML = html;
return tmp.textContent || tmp.innerText || '';
}
for the task. What's the Angular way of doing that? Or is it perfectly fine to do like that? Can directly accessing document
like that lead to problems, e.g. with mobile apps?
Note: There's an AngularJS related question, but I'm looking for an Angular2+ anwer. Plus I'm not sure whether the regex from that accepted answer is the way to go?