I try to return some HTML code from my AngularJs controller to the html data.
This is path of my html :
<div align="right">
{{chooseHtmlElement()}}">
</div>
And this is path of my AngularJs Controller:
$scope.chooseHtmlElement= function () {
var sum = $scope.chiQuadSum();
if (isNaN(sum)) {
return "";
}
if (sum > 17.00) {
return "<i class=\"fa fa-minus-circle\" style=\"color:red;\"></i>";
} else if (sum < 14.00) {
return "<i class=\"fa fa-check-circle\" style=\"color:green;\"></i>";
} else {
return "<i class=\"fa fa-circle\" style=\"color:orange;\"></i>";
}
}
The problem is when I return these string, the element is not shown as html element, but as text which you can read. Is there any possibility returning these string as html element?
ng-bind-html="chooseHtmlElement()"
should be it. – Newby