我想知道在实现NG_VALUE_ACCESSOR的自定义控件中触摸回调的正确实现是什么。
registerOnTouched(touched: () => {}) {
this.touched = touched;
}
我特别想知道,无论是点击下拉菜单,还是点击外部而不选择任何值,都应该拨打this.touched()
。触摸回调是接受信件还是仅反映控件的价值变化?
答案 0 :(得分:0)
/**
* A control is marked `touched` once the user has triggered
* a `blur` event on it.
*/
get touched(): boolean { return this._touched; }