title: How to use ng-if to test if a variable is defined
body: <p>Is there a way to use <code>ng-if</code> to test if a variable is defined, not just if it's truthy?</p>
  
  <p>In the example below (<a href="http://plnkr.co/edit/jKPN0dOHDWBtPxJHXv2R?p=preview">live demo</a>), the HTML displays a shipping cost for the red item only, because <code>item.shipping</code> is both defined and nonzero. I'd like to also display a cost for the blue item (shipping defined but zero), but not for the green item (shipping not defined). </p>
  
  <p>JavaScript:</p>
  
  <pre><code>app.controller('MainCtrl', function($scope) {
    $scope.items = [
        {
          color: 'red',
          shipping: 2,
        },
        {
          color: 'blue',
          shipping: 0,
        },
        {
          color: 'green',
        }
      ];
  });
  </code></pre>
  
  <p>HTML:</p>
  
  <pre><code>&lt;body ng-controller="MainCtrl"&gt;
    &lt;ul ng-repeat='item in items'&gt;
      &lt;li ng-if='item.color'&gt;The color is {{item.color}}&lt;/li&gt;
      &lt;li ng-if='item.shipping'&gt;The shipping cost is {{item.shipping}}&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>I tried doing <code>ng-if='angular.isDefined(item.shipping)'</code>, but it didn't work. Nor did <code>ng-if='typeof(item.shipping) !== undefined'</code>.</p>