what is the relationship of NG_VALUE_ACCESSOR, ControlValueAccessor interface in angular?

Discussão em 'Angular' iniciado por user1169587, Março 26, 2025.

  1. user1169587

    user1169587 Guest

    what is the relationship of NG_VALUE_ACCESSOR, ControlValueAccessor interface in angular? Is if I have the following statement (provide:NG_VALUE_ACCESSOR)

    @Component({
    selector: 'rm-header',
    templateUrl: './record-manager.component.html',
    styleUrls: ['./record-manager.component.scss'],
    providers: [{
    provide: NG_VALUE_ACCESSOR,
    useExisting: forwardRef(() => RecordManagerComponent),
    multi: true
    }]
    })


    then I already implement ControlValueAccessor, no need to explicitly writes

    export class ComponentA implements ControlValueAccessor


    ?

    but then I still need to implement: writeValue(), registerOnChange(), registerOnTouched(), and setDisabledState() defined in ControlValueAccessor interface?

    Continue reading...

Compartilhe esta Página