title: AngularJS show data if key exists
body: <p>I have a collection of data coming via <code>$http</code> call, in <code>JSON</code> format. It goes something like this:</p>
  
  <pre><code>{
  "projects": [
          { "url": "http://project-1-url.com", "src": "images/projects/1.png", "title": "Project 1", "tags": ["AngularJS","Web Design","Self Project"]},
          { "src": "images/projects/2.png", "title": "Project 2","tags": ["HTML","Plugin","Self Project"]}
      ]
  }
  </code></pre>
  
  <p>As you might've noticed, few objects in JSON doesn't have <code>URL</code> parameter. I am using <code>ngRepeat</code> to show the data something like this:</p>
  
  <pre><code>&lt;ul&gt;
  &lt;li ng-repeat="project in projects"&gt;{{ project.title }}&lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>Where, the projects are coming from controller as:</p>
  
  <pre><code>app.controller('MyCtrl', function ( $scope, $http) {
     $scope.projects = null;
     $http.get("http://api-endpoint-here").then(function (response) {
              $scope.projects = response.data;
     });
  });
  </code></pre>
  
  <p>I want to have some logic such that the JSON objects that have URL property should show up as links, while those not having one should just output title. Much like:</p>
  
  <pre><code>&lt;!-- If JSON has URL --&gt;
  &lt;li ng-repeat="project in projects"&gt;&lt;a href="project.url"&gt;{{ project.title }}&lt;/a&gt;&lt;/li&gt;
  &lt;!-- If JSON DO NOT have URL --&gt;
  &lt;li ng-repeat="project in projects"&gt;{{ project.title }}&lt;/li&gt;
  </code></pre>
  
  <p>Should I prepare some logic within controller? Or is it possible with some <code>ngShow</code> logic in the view?</p>