I got the code from another question and it's straightforward and working fine
<div ng-controller="ExampleController">
<p ng-bind-html="testHTML"></p>
(function(angular) {
'use strict';
angular.module('bindHtmlExample', ['ngSanitize'])
.controller('ExampleController', ['$scope', function($scope) {
$scope.testHTML = 'I am an <code>HTML</code>string with ' +
'<a href="#">links!</a> and other <em>stuff</em>';
}]);
})(window.angular);
Suppose, I'm getting an object and I want to show an element of the object
var obj = {
title: 'Title',
description: 'I am an <code>HTML</code>string with ' +
'<a href="#">links!</a> and other <em>stuff</em>'
};
$scope.testHTML = obj;
Then how should I bind only the description on the html end?
I've tried
<p ng-bind-html="{{testHTML.description}}"></p>
and
<p ng-bind-html="testHTML.description"></p>