-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Closed
Labels
P4A relatively minor issue that is not relevant to core functionsA relatively minor issue that is not relevant to core functionsfeatureThis issue represents a new feature or feature request rather than a bug or bug fixThis issue represents a new feature or feature request rather than a bug or bug fix
Description
Bug, feature request, or proposal:
Proposal
Currently
If a user wishes to surround MdErrors
with a structural directive, the errors will no longer be projected inside the mat-input-subscript-wrapper
.
<!-- This will not work -->
<md-form-field>
<input mdInput>
<ng-container *ngFor="let error of allErrors">
<md-error *ngIf="showError(error)">{{error.message}}</md-error>
</ng-container>
</md-form-field>
This is (sort of) expected behavior if you know that content projection works only on top level elements. Still, if you want to conditionally render your errors with ngFor
and ngIf
you have to use one of the workarounds (listed under Motivation).
Proposed
<!-- This could work -->
<md-form-field>
<input mdInput>
<md-error-container *ngFor="let error of allErrors">
<md-error *ngIf="showError(error)">{{error.message}}</md-error>
</md-error-container>
</md-form-field>
<!-- form-field.html -->
...
<div *ngSwitchCase="'error'" [@transitionMessages]="_subscriptAnimationState">
<ng-content select="md-error, md-error-container"></ng-content>
</div>
Reproduction
This is an example showing how it could work
http://plnkr.co/edit/6c6Zi6m1dNAnF10smWPK?p=preview
Motivation
Couple of issues bringing this up
Workarounds:
arowshan and steve-todorovrafaelss95
Metadata
Metadata
Assignees
Labels
P4A relatively minor issue that is not relevant to core functionsA relatively minor issue that is not relevant to core functionsfeatureThis issue represents a new feature or feature request rather than a bug or bug fixThis issue represents a new feature or feature request rather than a bug or bug fix