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

Ensure directives appear in errorTailor context #27

Open
dev054 opened this issue Jan 10, 2021 · 1 comment
Open

Ensure directives appear in errorTailor context #27

dev054 opened this issue Jan 10, 2021 · 1 comment
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@dev054
Copy link

dev054 commented Jan 10, 2021

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[ ] Performance issue
[x] Feature request
[ ] Documentation issue or request
[ ] Support request
[ ] Other... Please describe:

Current behavior

No error for this template:

<form [formGroup]="formGroup">
  <mat-form-field>
    <mat-label>Name</mat-label>
    <input matInput formControlName="name" [controlErrorAnchor]="nameError" />
    <mat-error><ng-template controlErrorAnchor #nameError="controlErrorAnchor"></ng-template></mat-error>
  </mat-form-field>
</form>

Expected behavior

Error for the template above, as there's no errorTailor hosted in <form>.

What is the motivation / use case for changing the behavior?

Currently if we try to use the directive controlErrorAnchor (also in others, but I just tested with controlErrorAnchor) without form, for example, we get no error and it lead us for a difficult debug caused due to a silly mistake. I want to propose a check (probably only in devMode) in this "children" directives in order to avoid losing time with this.

Environment


Angular version: 11.0.0
@NetanelBasal
Copy link
Member

You're welcome to create a PR.

@NetanelBasal NetanelBasal added the good first issue Good for newcomers label Jan 11, 2021
@NetanelBasal NetanelBasal added the enhancement New feature or request label Mar 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants