error-tailor
error-tailor copied to clipboard
Ensure directives appear in errorTailor context
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
You're welcome to create a PR.