angular-cn/public/docs/js/latest/api/forms/CheckboxControlValueAccesso...

234 lines
2.8 KiB
Plaintext

p.location-badge.
exported from <a href='../forms'>angular2/forms</a>
defined in <a href="https://github.com/angular/angular/tree/2.0.0-alpha.34/modules/angular2/src/forms/directives/checkbox_value_accessor.ts#L9-L62">angular2/src/forms/directives/checkbox_value_accessor.ts (line 9)</a>
:markdown
The accessor for writing a value and listening to changes on a checkbox input element.
# Example
```
<input type="checkbox" [ng-control]="rememberLogin">
```
.l-main-section
h2 Annotations
.l-sub-section
h3.annotation Directive
pre.prettyprint
code.
@Directive({
selector:
&#39;input[type=checkbox][ng-control],input[type=checkbox][ng-form-control],input[type=checkbox][ng-model]&#39;,
host: {
&#39;(change)&#39;: &#39;onChange($event.target.checked)&#39;,
&#39;(blur)&#39;: &#39;onTouched()&#39;,
&#39;[class.ng-untouched]&#39;: &#39;ngClassUntouched&#39;,
&#39;[class.ng-touched]&#39;: &#39;ngClassTouched&#39;,
&#39;[class.ng-pristine]&#39;: &#39;ngClassPristine&#39;,
&#39;[class.ng-dirty]&#39;: &#39;ngClassDirty&#39;,
&#39;[class.ng-valid]&#39;: &#39;ngClassValid&#39;,
&#39;[class.ng-invalid]&#39;: &#39;ngClassInvalid&#39;
}
})
.l-main-section
h2 Members
.l-sub-section
h3 constructor
pre.prettyprint
code.
constructor(cd: NgControl, renderer: Renderer, elementRef: ElementRef)
:markdown
.l-sub-section
h3 cd
:markdown
.l-sub-section
h3 onChange
:markdown
.l-sub-section
h3 onTouched
:markdown
.l-sub-section
h3 renderer
:markdown
.l-sub-section
h3 elementRef
:markdown
.l-sub-section
h3 writeValue
pre.prettyprint
code.
writeValue(value: any)
:markdown
.l-sub-section
h3 ngClassUntouched
:markdown
.l-sub-section
h3 ngClassTouched
:markdown
.l-sub-section
h3 ngClassPristine
:markdown
.l-sub-section
h3 ngClassDirty
:markdown
.l-sub-section
h3 ngClassValid
:markdown
.l-sub-section
h3 ngClassInvalid
:markdown
.l-sub-section
h3 registerOnChange
pre.prettyprint
code.
registerOnChange(fn: (_: any) =&gt; {})
:markdown
.l-sub-section
h3 registerOnTouched
pre.prettyprint
code.
registerOnTouched(fn: () =&gt; {})
:markdown