title: Angular Renderer2 setStyle only if specific class present on host
body: <p>I have a (spinner) directive that may add/remove a class (<code>.spinner</code>) using <code>@HostBinding</code>. It also adds/removes an <code>img</code> (spinner.gif) when activated. </p>
  
  <p>If <code>.spinner</code> is present on the host, a bunch of styles defined in the <code>scss</code> file are applied:</p>
  
  <pre><code>.spinning {
    position: relative;
   }
  
  .spinning img {
    display: block;
    width: 24px;
    margin: 0;
    position: absolute;
    top: 50%;
    left: 50%;
    margin-right: -50%;
    transform: translate(-50%, -50%)
   }
  </code></pre>
  
  <p>I want to apply these styles on the host from within my directive. Is it possible to apply styles on the host only if a certain class is present using <code>Renderer2</code> and <code>ElementRef</code>? </p>
  
  <p>This obviously doesn't work:</p>
  
  <pre><code>this.renderer.setStyle(this.el.nativeElement, '.spinning position', 'relative');
  </code></pre>