Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/29.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
触控回调在Angular中的正确实现_Angular - Fatal编程技术网

触控回调在Angular中的正确实现

触控回调在Angular中的正确实现,angular,Angular,我想知道在实现NG_VALUE_访问器的自定义控件中,触摸回调的正确实现是什么 registerOnTouched(touched: () => {}) { this.touched = touched; } 我特别想知道,单击下拉菜单,但单击外部而不选择任何值是否应该调用this.toucted()。触摸回调是按字母顺序执行还是仅反映控件的值更改 /** * A control is marked `touched` once the user has triggered

我想知道在实现NG_VALUE_访问器的自定义控件中,触摸回调的正确实现是什么

registerOnTouched(touched: () => {}) {
  this.touched = touched;
}
我特别想知道,单击下拉菜单,但单击外部而不选择任何值是否应该调用
this.toucted()
。触摸回调是按字母顺序执行还是仅反映控件的值更改

/**
  * A control is marked `touched` once the user has triggered
  * a `blur` event on it.
  */
  get touched(): boolean { return this._touched; }