title: Angularjs directive to replace text
body: <p>How would I create a directive in angularjs that for example takes this element:</p>
  
  <pre><code>&lt;div&gt;Example text http://example.com&lt;/div&gt;
  </code></pre>
  
  <p>And convert it in to this </p>
  
  <pre><code>&lt;div&gt;Example text &lt;a href="http://example.com"&gt;http://example.com&lt;/a&gt;&lt;/div&gt;
  </code></pre>
  
  <p>I already have the functionality written to auto link the text in a function and return the html (let's call the function "autoLink" ) but i'm not up to scratch on my directives.</p>
  
  <p>I would also like to add a attribute to the element to pass a object in to the directive. e.g.</p>
  
  <pre><code>&lt;div linkprops="link.props" &gt;Example text http://example.com&lt;/div&gt;
  </code></pre>
  
  <p>Where link.props is object like {a: 'bla bla', b: 'waa waa'} which is to be passed to the autoLink function as a second param (the first been the text).</p>