title: How to get class attribute via renderer (or alternative) in angular2
body: <p>I've found an alternative for nativeElement.classList.add() in angular2.
  (original question described here: <a href="https://stackoverflow.com/questions/35506395">looking for nativeElement.classList.add() alternative</a>)</p>
  
  <p>But now I want to get the class attribute before rendering the new one.
  Because if the color value changes a new class is added, but the old one is not removed.</p>
  
  <p>So I'm trying to resolve</p>
  
  <pre><code>&lt;button md-button color="accent" class="myClass"&gt;&lt;/button&gt;
  </code></pre>
  
  <p>to </p>
  
  <pre><code>&lt;button md-button color="accent" class="myClass md-accent"&gt;&lt;/button&gt;
  </code></pre>
  
  <p>When the color property changes to warn, it should render</p>
  
  <pre><code>&lt;button md-button color="warn" class="myClass md-warn"&gt;&lt;/button&gt;
  </code></pre>
  
  <p>For now it renders</p>
  
  <pre><code>&lt;button md-button color="warn" class="myClass md-accent md-warn"&gt;&lt;/button&gt;
  </code></pre>
  
  <p>So what I try to do is: before updating <code>this.color_</code>, remove the <code>md-this.color_</code> class .</p>
  
  <pre><code>@Input()
  set color(value: string) {
      // READ CLASS ATTRIBUTE HERE, SO I CAN REMOVE THE OLD md-this.color_
      this.color_ = value;
  
      this.renderer.setElementClass(this.elementRef, 'md-' + this.color_, true);
  }
  </code></pre>
  
  <p>Getting the attribute through nativeElement is not an option because this doesn't work in webworkers.</p>
  
  <p>Any idea's ?</p>