title: Protractor ng-if condition and element availability
body: <p>I want to check whether element displayed or not depends upon ng-if condition, </p>
  
  <pre><code>&lt;div id="discount_percent" ng-if="data.isDiscount"&gt;  
       &lt;div id="dis_available"&gt; Discount: {{data.discount}} % &lt;/div&gt; 
  &lt;/div&gt; 
  </code></pre>
  
  <p>I want to check if <code>data.isDiscount is true</code> than <code>div "discount_percent"</code> &amp; <code>dis_available</code> should display. </p>
  
  <blockquote>
    <p><strong><em>Note:</em></strong> div "discount_percent" and "dis_available" won't be present in DOM if data.isDiscount is false.</p>
  </blockquote>
  
  <p>I did following way, but I'm not fully satisfied with my solution. </p>
  
  <pre><code>var discountPercentId = element(by.id('discount_percent'));
  discountPercentId.isPresent().then(function (present){
     if(present){
        expect(discountPercentId.evaluate("data.isDiscount")).toBeTruthy();
        expect(discountPercentId.element(by.id("dis_available")).isDisplayed()).toBeTruthy();
     }
  }); 
  </code></pre>
  
  <p>Any better approach to do? If condition true than check its availability!!! </p>