title: how to change particular array element background color in angular 6
body: <p>below is my HTML code, I want to change the NameList array color while clicking on that particular array index, example if I click on <code>NameList[1]</code>
  only that element background color change to green, again if I click <code>NameList[2]</code> then <code>NameList[1]</code> background change to white and <code>nameList[2]</code> change to green , how to fix this in angular 6.
  <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&gt;
   &lt;ul *ngFor="let name of NameList"&gt;
        &lt;tr&gt;
           &lt;td class=""  (click)="nameDetail(name)"&gt;{{name}}&lt;/td&gt;
          &lt;/tr&gt;
    &lt;/ul&gt;
    &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>