Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: implement ControlValueAccessor in the code snippet #21905

Merged
merged 1 commit into from Feb 16, 2021

Conversation

@AlexElin
Copy link
Contributor

@AlexElin AlexElin commented Feb 15, 2021

this should implement ControlValueAccessor because
valueAccessor has type ControlValueAccessor | null
in the this.ngControl.valueAccessor = this; (line 216)

Affected URL: https://material.angular.io/guide/creating-a-custom-form-field-control#ngcontrol

`this` should implement `ControlValueAccessor` because
`valueAccessor` has type `ControlValueAccessor | null`
in the `this.ngControl.valueAccessor = this;`
@AlexElin AlexElin requested a review from jelbourn as a code owner Feb 15, 2021
@google-cla google-cla bot added the cla: yes label Feb 15, 2021
@@ -202,7 +202,7 @@ To resolve this, remove the `NG_VALUE_ACCESSOR` provider and instead set the val
// },
],
})
export class MyTelInput implements MatFormFieldControl<MyTel> {
export class MyTelInput implements MatFormFieldControl<MyTel>, ControlValueAccessor {

This comment has been minimized.

@crisbeto

crisbeto Feb 15, 2021
Member

There are some more snippets like this one after the ngControl section. Should it be added there as well?

This comment has been minimized.

@AlexElin

AlexElin Feb 15, 2021
Author Contributor

I've found only one snippet after the ngControl section. It's improving-accessibility.
Probably, there's no need to add ControlValueAccessor there becasue forms are not main subject of that section.

This comment has been minimized.

@crisbeto

crisbeto Feb 15, 2021
Member

I guess the way I've been reading the guide is that the sections build on top of each other so it would be weird if one snippet had it and the other one didn't.

This comment has been minimized.

@AlexElin

AlexElin Feb 15, 2021
Author Contributor

I've reread the docs and found very important point in the errorState section:

Since we're not using an NgControl in this example, we don't need to do anything ...

So I think there's no need to add ControlValueAccessor in other sections except ngControl
What do you think?

This comment has been minimized.

@crisbeto

crisbeto Feb 15, 2021
Member

Sure, makes sense.

@mmalerba mmalerba merged commit 8726e57 into angular:master Feb 16, 2021
16 checks passed
16 checks passed
Inclusive Language Check completed with success
Details
ci/angular: merge status All checks passed!
ci/circleci: api_golden_checks Your tests passed on CircleCI!
Details
ci/circleci: bazel_build Your tests passed on CircleCI!
Details
ci/circleci: build_release_packages Your tests passed on CircleCI!
Details
ci/circleci: e2e_tests Your tests passed on CircleCI!
Details
ci/circleci: integration_tests Your tests passed on CircleCI!
Details
ci/circleci: lint Your tests passed on CircleCI!
Details
ci/circleci: ngcc_compatibility Your tests passed on CircleCI!
Details
ci/circleci: tests_browserstack Your tests passed on CircleCI!
Details
ci/circleci: tests_local_browsers Your tests passed on CircleCI!
Details
ci/circleci: tests_saucelabs Your tests passed on CircleCI!
Details
ci/circleci: upload_release_packages Your tests passed on CircleCI!
Details
ci/circleci: view_engine_build Your tests passed on CircleCI!
Details
ci/circleci: view_engine_test Your tests passed on CircleCI!
Details
cla/google All necessary CLAs are signed
mmalerba added a commit that referenced this pull request Feb 16, 2021
`this` should implement `ControlValueAccessor` because
`valueAccessor` has type `ControlValueAccessor | null`
in the `this.ngControl.valueAccessor = this;`

(cherry picked from commit 8726e57)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants