title: Conditionally add target="_blank" to links with Angular JS
body: <p>I am building a navigation tree in Angular JS. Most links in the tree will point to pages within my website, but some may point to external sites.</p>
  
  <p>If the href of a link begins with http:// or https:// then I am assuming the link is for an external site (a regex like <code>/^https?:\/\//</code> does the trick).</p>
  
  <p>I would like to apply the target="_blank" attribute to these links. I was hoping to do this with angular when I am creating my links:</p>
  
  <pre><code>&lt;ul&gt;
      &lt;li ng-repeat="link in navigation"&gt;
          &lt;a ng-href="{{link.href}}" [add target="_blank" if link.href matches /^https?:\/\//]&gt;{{link.title}}&lt;/a&gt;
      &lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>Can anyone help me out?</p>
  
  <p>Thanks</p>