I have a data that contains HTML (for exemple I have <b>XXXX</b>) and I would like to display it as:
XXXX
I want this to be rendered as bold when it gets displayed on view.
How can I do that?
You can use ng-bind-html that exaclty do what you are looking for.
var app = angular.module('myApp', ['ngSanitize']);
app.controller('MainCtrl', function ($scope) {
$scope.text = "<b>XXXX</b>";
});
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.1/angular-sanitize.min.js"></script>
<div ng-app="myApp" ng-controller="MainCtrl">
<div ng-bind-html="text"></div>
</div>
Note that you will have to include ngSanitize in your dependencies to be able to use it.