title: Passing HTML to a template inside Angular directive
body: <p>I need the HTML in newValue to work but it seems to just spit out escaped charaters</p>
  
  <pre><code>.directive('ngLookup', function () {
      return {
          restrict: 'A',
          scope : {
              text : '='
          },
          template: '{{newValue}}',
          link: function (scope, elem, attrs) {
              scope.newValue = scope.text.replace(/test/g,'&lt;a href="javascript:;"&gt;test&lt;/a&gt;');                
          }
      }
  })
  </code></pre>
  
  <p>My solution using the answer below:</p>
  
  <pre><code>.directive('ngLookup', function ($compile) {
      return {
          restrict: 'EA',
          scope : {
              text : '='
          },
          link: function (scope, elem, attrs) {
              var txt = '&lt;span&gt;'+scope.text.replace(/test/g,'&lt;a href="javascript:;"&gt;test&lt;/a&gt;')+"&lt;/span&gt;";
              var newElement = $compile(txt)(scope);
              elem.replaceWith(newElement);
          }
      }
  })
  </code></pre>