Skip to content

writeValue gets called before ngOnInit #15434

@romansattler

Description

@romansattler

What is the expected behavior?

ngOnInit should be called before writeValue

What is the current behavior?

writeValue gets called before ngOnInit when the value accessor is set directly as described in the docs under ngControl, i.e. by using

if (this.ngControl != null) {
    this.ngControl.valueAccessor = this;
}

in the constructor to avoid cyclic dependency error when providing NG_VALUE_ACCESSOR.

What are the steps to reproduce?

Stackblitz

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Angular/Material: 7.2.8

Is there anything else we should know?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions