title: Angular 6 check for the existence of a variable with ngIf
body: <p>How can I check for the existence of a value in angular 6 with ngIf in a nested json object?
  I have this Json returned from an api call:</p>
  
  <pre><code> {
  
   "orth": ["axxam"],
  
   "gram":[
        {"pos": ["isem"],
         "feminine": ["taxxamt"],
         "plural":"ixxamen"}
          ]
    }
  </code></pre>
  
  <p>I managed to get the values for "orth" and "pos". What I cannot get is this: I want first to test if the pos == isem, if and only if this is true, then I will show the values for "feminine" and "plural".
  Here is the code so far:</p>
  
  <pre><code> &lt;span&gt; spelling: {{elements?.orth}}&lt;/span&gt; 
   &lt;span&gt; POS: {{elements?.gram[0].pos}}&lt;/span&gt;
  </code></pre>
  
  <p>The following is not working:</p>
  
  <pre><code>  &lt;span *ngIf="elements?.gram[0].pos===isem"&gt; POS: 
   {{elements?.gram[0].feminine}}&lt;/span&gt;
  </code></pre>
  
  <p>Additionally, can I loop through the object?
  I tried this with no results:</p>
  
  <pre><code> &lt;span *ngFor="let element of elements.gram | keyvalue"&gt;
    {{element.key}}: {{element.value}}
  </code></pre>