Of course {{ getVal() }}
will work as JB Nizet suggests when you want the returned value of your function to appear somewhere inline in the body of some HTML string. However, what you're actually after is...
Angular 1 Style:
<div ng-bind="getVal()"></div>
becomes...
Angular 2+ ng-bind equivalent:
<div [textContent]="getVal()"></div>
Angular 2+ ng-bind-html equivalent:
<div [innerHtml]="getVal()"></div>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…