title: Displaying HTML in an Angular 1.3.9 view with $sce
body: <p>I'm trying to display an HTML string in my Angular view.</p>
  
  <p>At first, I naively tried this :</p>
  
  <pre><code>&lt;p&gt;{{ad.text}}&lt;/p&gt;
  
  $scope.ad = { 'text' : '&lt;a href="#"&gt;Link&lt;/a&gt;'}; // Dynamically fetched, etc. This is just an example text
  </code></pre>
  
  <p>But this just displays <code>&lt;a href="#"&gt;Link&lt;/a&gt;</code> in the view, not : <a href="http://#" rel="nofollow noreferrer">link</a>.</p>
  
  <p>After some research, I stumbled upon ngSanitize. I tried it, but it totally strips off all HTML code to leave just raw text. Pretty secure indeed. A bit too much, actually. Anyway, <strong>ngSanitize is now outdated</strong>.</p>
  
  <p><a href="https://stackoverflow.com/questions/9381926/insert-html-into-view-using-angularjs">This SO post</a> indicates that now the $sce service has to be used instead of ngSnitize.</p>
  
  <p>Following these various solutions, here is what I came up with :</p>
  
  <p>HTML</p>
  
  <pre><code>&lt;p ng-bind-html="htmlAdText"&gt;&lt;/p&gt;
  </code></pre>
  
  <p>JS</p>
  
  <pre><code>$scope.ad = { 'text' : '&lt;a href="#"&gt;Link&lt;/a&gt;'};
  
  $scope.htmlAdText = $sce.trustAsHtml($scope.ad.text);
  </code></pre>
  
  <p>But this error comes in the console :</p>
  
  <pre><code>ReferenceError: $sce is not defined
  </code></pre>
  
  <p>What bugs me is that <strong>the $sce service is supposed to be part of Angular's core since v1.2, and I'm using v1.3.9</strong>.</p>
  
  <p>What's going on here?
  Does anyone have a definitive method to display HTML in an AngularJS view ( without filters that just leave the raw text) ?</p>