Toggle a class in Angular

To place a toggle on a button in Angular, do:

<button (click)=“foo = !foo”>

This toggles foo to true or false.

Then you can apply the toggle on something else, for instance a div you want to hide/show:

<div [class.is-shown]=“foo”>