title: Angular 6: Additional class if boolean is true
body: <p>I'm trying to implement a voting system, where the active vote gets a blue background. For this I'm using 2 booleans to keep track of the score and the selected option. I tried using NgClass, but I can't seem to figure out how it works in my case, since I'd add an additional class to the existing 2 classes. </p>
  
  <p><strong>css</strong></p>
  
  <pre><code> .voting{
      cursor: pointer; 
      display: inline;
    }
    .activeVote{
      background: #2980b9;
    }
  </code></pre>
  
  <p><strong>HTML</strong></p>
  
  <p>voting class and noSelect should always be active, but clicking increaseUpvote() should add the activeVote class to that one since the upvoted boolean will be true. Same thing should happen to the downvote option.</p>
  
  <pre><code> &lt;p style="font-size: 28px;"&gt;{{post.upvotes}}
            &lt;mat-icon class="voting noSelect" (click)="increaseUpvote()"&gt;arrow_upward
            &lt;/mat-icon&gt;
            &lt;mat-icon class="voting noSelect" (click)="increaseDownvote()"&gt;
              arrow_downward
            &lt;/mat-icon&gt;
          &lt;/p&gt;
  </code></pre>
  
  <p><strong>Typescript</strong></p>
  
  <pre><code>  public upvoted: boolean = false;
    public downvoted: boolean = false;
  
    increaseUpvote(): void {
      if (this.downvoted) {
        this.post.upvote();
        this.downvoted = false;
      }
      if (!this.upvoted) {
        this.post.upvote();
        this.upvoted = true;
      } else if (this.upvoted) {
        this.post.removeUpvote();
        this.upvoted = false;
      }
    }
  
    increaseDownvote(): void {
      if (this.upvoted) {
        this.post.removeUpvote();
        this.upvoted = false;
      }
      if (!this.downvoted) {
        this.post.removeUpvote();
        this.downvoted = true;
      } else if (this.downvoted) {
        this.post.upvote();
        this.downvoted = false;
      }
    }
  </code></pre>