0

I'm using ng-bind-html and have a div with a class and an id.

<div class="myCustomClass" id="myCustomID">My Content</div>

When I inspect the element I can see the class but the ID is missing. Here is a working plunkr illustrating the issue: https://plnkr.co/edit/iHeQQI?p=preview

Crhistian Ramirez
  • 1,066
  • 12
  • 20

1 Answers1

1

You need to process you html source with $sce service like this:

app.controller('Ctrl', function($scope, $sce) {
  $scope.html = $sce.trustAsHtml('<div id="myID" class="myClass">Inspecting this element shows the class but not the ID</div>');
});
k10der
  • 716
  • 1
  • 10
  • 15