title: How can I change a body tag class in Angular 10 (best practice)?
body: <p>I want to switch between two classes (light and dark) at TAG Body.</p>
  <p>What I did? I created a service:</p>
  <pre class="lang-js prettyprint-override"><code>import { Injectable } from '@angular/core';
  
  @Injectable({
    providedIn: 'root'
  })
  export class ThemeService {
    body = document.body;
  
    constructor() { }
  
    changeLight() {
      this.body.classList.replace('light', 'dark');
    }
  
    changeDark() {
      this.body.classList.replace('dark', 'light');
    }
  }
  </code></pre>
  <p>It is working as expected but I know that this code does not use best practices.<br />
  What is the correct way to change between these two classes?</p>