ControlValueAccessor

ControlValueAccessor

Stable Interface

Interface Overview

interface ControlValueAccessor {
  writeValue(obj: any) : void
  registerOnChange(fn: any) : void
  registerOnTouched(fn: any) : void
  setDisabledState(isDisabled: boolean) : void
}

Interface Description

A bridge between a control and a native element.

A ControlValueAccessor abstracts the operations of writing a new value to a DOM element representing an input control.

Please see DefaultValueAccessor for more information.

Interface Details

writeValue(obj: any) : void

Write a new value to the element.

registerOnChange(fn: any) : void

Set the function to be called when the control receives a change event.

registerOnTouched(fn: any) : void

Set the function to be called when the control receives a touch event.

setDisabledState(isDisabled: boolean) : void

This function is called when the control status changes to or from "DISABLED". Depending on the value, it will enable or disable the appropriate DOM element.

exported from @angular-forms-index, defined in @angular/forms/src/directives/control_value_accessor.ts

© 2010–2017 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v2.angular.io/docs/ts/latest/api/forms/index/ControlValueAccessor-interface.html

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部