The most foolproof method is to use either innerText
or textContent
.
<span class="fullname" [textContent]="finance_fullname"></span>
<span class="fullname" [innerText]="finance_fullname"></span>
Even AngularJS preferred textContent
for one-way binding. It simply retrieves the model value and places it directly into the designated HTML element. Even if you pass html
, it will display the HTML as text (decoded HTML) on the page.
See Demo
Using innerHTML
could also work, but be cautious as it opens up the possibility of injecting harmful content onto your page in the form of HTML.