title: How to apply ngClass to element based stated?
body: <p>I have a service that stores a state of opened block as:</p>
  <pre><code>export class BlocksStateService {
     public openedBlockState = new Map&lt;number, boolean&gt;;
  
     setState(id: number, state: boolean) {
       this.openedBlockState.set(id, state);
     }
    
     getState(id: number): boolean {
        return this.openedBlockState.get(id);
     }
  }
  </code></pre>
  <p>I use this class in component:</p>
  <pre><code>public isBlockOpened(id: number): boolean {
       return this.blocksStateService.getState(id);
  }
  </code></pre>
  <p>Then in template:</p>
  <pre><code>&lt;div [class.opened]=&quot;isBlockOpened(id)&quot;&gt;&lt;/div&gt;
  </code></pre>
  <p>I know using function in template is bad practice. How to apply model data to ngClass more properly?</p>