Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save nicolanrizzo/9fd78c6eb837ff70811cbcc33a6076fb to your computer and use it in GitHub Desktop.
Save nicolanrizzo/9fd78c6eb837ff70811cbcc33a6076fb to your computer and use it in GitHub Desktop.
Reversed checkboxes in Angular reactive forms
<form [formGroup]="form">
<input
type="checkbox"
[ngModel]="!form.get('myControl').value"
(ngModelChange)="form.get('myControl').patchValue(!$event)"
[ngModelOptions]="{standalone: true}"
>
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment