title: Angular2 check if object has peoperty inside *ngIf
body: <pre><code>export interface Element {    
      name: string;   
  }
  
  export class Room implements Element {
  name: string; 
  type:string
  }
  
  export class Hall implements Element {
  name: string;
  }
  </code></pre>
  
  <p>and my varibale type is like below</p>
  
  <pre><code>selectedElement: Element;
  </code></pre>
  
  <p>now in html how can I check if the object is having property 'type' or not?</p>
  
  <pre><code>&lt;div *ngIf="selectedElement?.type"&gt;
  my div
  &lt;/div&gt;
  </code></pre>