Get access to FormControl from the custom form component in Angular

前端 未结 5 1080
野的像风
野的像风 2020-11-29 00:09

I have a custom form control component in my Angular application, which implements ControlValueAccessor interface.

However, I want to access the F

5条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-29 00:39

    As @Ritesh has already written in the comment you can pass form control as an input binding:

    
    
    

    And then you can get form control instance inside your custom form component like this:

    @Input() control: FormControl;
    

提交回复
热议问题