title: Requiring a checkbox to be checked
body: <p>I want a button to be disabled until a checkbox has been checked using a FormBuilder for Angular. I don't want to explicitly check the value of the checkbox and would prefer to use a validator so that I can simply check <code>form.valid</code>.</p>
  
  <p>In both validation cases below the checkbox is </p>
  
  <pre class="lang-typescript prettyprint-override"><code>interface ValidationResult {
    [key:string]:boolean;
  }
  
  export class CheckboxValidator {
    static checked(control:Control) {
      return { "checked": control.value };
    }
  }
  
  @Component({
    selector: 'my-form',
    directives: [FORM_DIRECTIVES],
    template: `  &lt;form [ngFormModel]="form" (ngSubmit)="onSubmit(form.value)"&gt;
      &lt;input type="checkbox" id="cb" ngControl="cb"&gt;
      &lt;button type="submit" [disabled]="!form.valid"&gt;
      &lt;/form&gt;`
  })
  
  export class SomeForm {
    regForm: ControlGroup;
  
    constructor(fb: FormBuilder) {
      this.form = fb.group({
        cb: [ CheckboxValidator.checked ]
        //cb: [ false, Validators.required ] &lt;-- I have also tried this
      });
    }
  
    onSubmit(value: any) {
      console.log('Submitted: ', this.form);
    }
  }
  </code></pre>