I have the following code
Template:
<div [formGroup]="booksFormGroup" class="btn-group" data-toggle="buttons">
    <ng-container *ngFor="let book of books">
        <label class="btn" [ngClass]="{'active': book.Id === selectedBookId}"
            (click)="bookClicked(book.Id)">
            <input type="checkbox" class="toggle" [value]="book.Id" formControlName="buttonsBook">{{book.Name}}
        </label>
    </ng-container>
</div>
<button (click)=onClicked()>Click</button>
TS file:
this.buttonsBook = new FormControl();
this.booksFormGroup = new FormGroup({
    buttonsBook: this.buttonsBook,
});
onClicked(){
    var selected = this.booksFormGroup.value.buttonsBook
}
When I click the button I only get the value of the last checkbox I checked even if more than one is selected. I need to get all of the selected checkboxes values.
I saw some solutions but they are not based on reactive forms but rather a mixture of template and reactive which I don't really like.