title: How to style a html element in typescript / angular
body: <p>I am trying to set property to html element but getting an error <strong>Type 'HTMLCollectionOf' is not assignable to type 'HTMLElement'</strong></p>
  
  <p>Here is my typescript code---</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>let elem: HTMLElement= document.getElementsByClassName('notification-top-bar');
        setTimeout(elem.setAttribute("style", "display:none;"), this.duration);</code></pre>
  </div>
  </div>
  </p>
  
  <p>Here is my HTML code---</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="row"&gt;
    &lt;div *ngFor="let n of notifications" class="notification-top-bar" [ngClass]="type" style="display: block;"&gt;
      {{message}}  
      &lt;a class="close glyphicon glyphicon-close" (click)="onCloseNotifications($event)"&gt;&lt;/a&gt;
      &lt;p&gt;{{n}}&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>