title: Can you get the component encapsulation host ID?
body: <p>Is there a way to get the encapsulation host id that is given to a component?</p>
  
  <p>If you have a component that is using <code>ViewEncapsulation.Emulated</code> the element in the <strong>DOM</strong> will have an attribute name of something like <code>_nghost-par-2.</code> Which, is a <strong>unique ID</strong> given to the component to encapsulate the associated styles.</p>
  
  <p>How do you get that ID as part of the component's constructor?</p>
  
  <p><strong>Something to the effect of:</strong></p>
  
  <pre><code>@Component({
    hostId:string;
    ...
  })
  export class myComponent implements OnInit {
    constructor(host:Host) {
      this.hostId = host.id;
    }
    ...
  }
  </code></pre>