title: Angular js (1.4) Using Ternary operator inside ng-repeat to show different html?
body: <pre><code>&lt;tr ng-repeat="(field, value) in vm.params track by $index"&gt;
    &lt;td&gt;{{::field}}&lt;/td&gt;
    &lt;td  hkey="{{field}}"&gt;  {{value.include('http')?&lt;a href ="{{value}}"&gt;{{value}}&lt;/a&gt;:{{value}} }}&lt;/td&gt;
  
  &lt;/tr&gt;
  </code></pre>
  
  <p>In the above Angular view I wanted the value field to check if the value contains string 'http', if so wrap an anchor tag around it so its clickable else show regular text value. </p>
  
  <p>Its not working out right , here its what its showing,</p>
  
  <p><a href="https://i.stack.imgur.com/iCYfm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iCYfm.png" alt="enter image description here"></a> </p>
  
  <p>how to do this properly?.</p>
  
  <p>i attempted to do it from the controller  like this </p>
  
  <pre><code>      vm.params["Source Link"]?vm.params["Source Link"] = '&lt;a href='+vm.params['Source Link']+'&gt;link&lt;/a&gt;':""
  </code></pre>
  
  <p>But data is displaying in string form not html, i see it with anchor tag and everything.</p>
  
  <p>vm.params looks something like this</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>    {
      Provider Name: "MARIO BLOUNT",
      Provider State: "WV",
      Provider City: "BRIDGEPORT",
      Action Date: "06/03/2014",
      Provider Source: "HEALTH CARE FRAUD FILE",
      Provider Type: "PHARMACIST",
      Action Description: "CHARGED BY INDICTMENT WITH CONSPIRACY TO ILLEGALLY 
      PRESCRIBE AND DISTRIBUTE OXYCODONE",
      Clinic Name: "BEST CARE PHARMACY; MARIO DAVID BLOUNT RPH",
      Source Link: "https://www.dea.gov/press-releases/201",
      }</code></pre>
  </div>
  </div>
  </p>