Avatar ·

Two-way data binding for checkbox in Angular 2: how to do it correctly?

Hello everyone! I'm new to Angular 2 (now Angular, but writing in TypeScript) and trying to implement two-way data binding for a regular HTML checkbox. I've read tons of tutorials but still get confused. I have a component with a simple flag `isChecked: boolean = false;`. I want the value in the component to change when I click on the checkbox, and vice versa — if I programmatically change `isChecked`, the checkbox should update. I tried using `[(ngModel)]`, like for input type="text", but got an error in the console: "No value accessor for form control with name: 'myCheckbox'". I added `FormsModule` to `app.module.ts`, but it still doesn't work. Here's my current code: ```typescript // my-component.component.ts import { Component } from '@angular/core'; @Component({ selector: 'app-my-compone