Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(material/schematics): switch to new control flow (#28106)
Reworks our schematics to use the new control from in Angular v17. (cherry picked from commit 328e4d2)
- Loading branch information
Showing
5 changed files
with
65 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,63 +15,62 @@ | |
<div class="col"> | ||
<mat-form-field class="full-width"> | ||
<input matInput placeholder="First name" formControlName="firstName"> | ||
<mat-error *ngIf="addressForm.controls['firstName'].hasError('required')"> | ||
First name is <strong>required</strong> | ||
</mat-error> | ||
@if (addressForm.controls['firstName'].hasError('required')) { | ||
<mat-error>First name is <strong>required</strong></mat-error> | ||
} | ||
</mat-form-field> | ||
</div> | ||
<div class="col"> | ||
<mat-form-field class="full-width"> | ||
<input matInput placeholder="Last name" formControlName="lastName"> | ||
<mat-error *ngIf="addressForm.controls['lastName'].hasError('required')"> | ||
Last name is <strong>required</strong> | ||
</mat-error> | ||
@if (addressForm.controls['lastName'].hasError('required')) { | ||
<mat-error>Last name is <strong>required</strong></mat-error> | ||
} | ||
</mat-form-field> | ||
</div> | ||
</div> | ||
<div class="row"> | ||
<div class="col"> | ||
<mat-form-field class="full-width"> | ||
<textarea matInput placeholder="Address" formControlName="address"></textarea> | ||
<mat-error *ngIf="addressForm.controls['address'].hasError('required')"> | ||
Address is <strong>required</strong> | ||
</mat-error> | ||
@if (addressForm.controls['address'].hasError('required')) { | ||
<mat-error>Address is <strong>required</strong></mat-error> | ||
} | ||
</mat-form-field> | ||
</div> | ||
</div> | ||
<div class="row" *ngIf="!hasUnitNumber"> | ||
<div class="col"> | ||
<button mat-button type="button" (click)="hasUnitNumber = !hasUnitNumber"> | ||
+ Add C/O, Apt, Suite, Unit | ||
</button> | ||
</div> | ||
</div> | ||
<div class="row" *ngIf="hasUnitNumber"> | ||
<div class="row"> | ||
<div class="col"> | ||
<mat-form-field class="full-width"> | ||
<textarea matInput placeholder="Address 2" formControlName="address2"></textarea> | ||
</mat-form-field> | ||
@if (hasUnitNumber) { | ||
<mat-form-field class="full-width"> | ||
<textarea matInput placeholder="Address 2" formControlName="address2"></textarea> | ||
</mat-form-field> | ||
} @else { | ||
<button mat-button type="button" (click)="hasUnitNumber = !hasUnitNumber"> | ||
+ Add C/O, Apt, Suite, Unit | ||
</button> | ||
} | ||
</div> | ||
</div> | ||
<div class="row"> | ||
<div class="col"> | ||
<mat-form-field class="full-width"> | ||
<input matInput placeholder="City" formControlName="city"> | ||
<mat-error *ngIf="addressForm.controls['city'].hasError('required')"> | ||
City is <strong>required</strong> | ||
</mat-error> | ||
@if (addressForm.controls['city'].hasError('required')) { | ||
<mat-error>City is <strong>required</strong></mat-error> | ||
} | ||
</mat-form-field> | ||
</div> | ||
<div class="col"> | ||
<mat-form-field class="full-width"> | ||
<mat-select placeholder="State" formControlName="state"> | ||
<mat-option *ngFor="let state of states" [value]="state.abbreviation"> | ||
{{ state.name }} | ||
</mat-option> | ||
@for (state of states; track state) { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
crisbeto
Author
Member
|
||
<mat-option [value]="state.abbreviation">{{ state.name }}</mat-option> | ||
} | ||
</mat-select> | ||
<mat-error *ngIf="addressForm.controls['state'].hasError('required')"> | ||
State is <strong>required</strong> | ||
</mat-error> | ||
@if (addressForm.controls['state'].hasError('required')) { | ||
<mat-error>State is <strong>required</strong></mat-error> | ||
} | ||
</mat-form-field> | ||
</div> | ||
</div> | ||
|
40 changes: 21 additions & 19 deletions
40
...oard/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.html.template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,26 @@ | ||
<div class="grid-container"> | ||
<h1 class="mat-h1">Dashboard</h1> | ||
<mat-grid-list cols="2" rowHeight="350px"> | ||
<mat-grid-tile *ngFor="let card of cards | async" [colspan]="card.cols" [rowspan]="card.rows"> | ||
<mat-card class="dashboard-card"> | ||
<mat-card-header> | ||
<mat-card-title> | ||
{{card.title}} | ||
<button mat-icon-button class="more-button" [matMenuTriggerFor]="menu" aria-label="Toggle menu"> | ||
<mat-icon>more_vert</mat-icon> | ||
</button> | ||
<mat-menu #menu="matMenu" xPosition="before"> | ||
<button mat-menu-item>Expand</button> | ||
<button mat-menu-item>Remove</button> | ||
</mat-menu> | ||
</mat-card-title> | ||
</mat-card-header> | ||
<mat-card-content class="dashboard-card-content"> | ||
<div>Card Content Here</div> | ||
</mat-card-content> | ||
</mat-card> | ||
</mat-grid-tile> | ||
@for (card of cards | async) { | ||
<mat-grid-tile [colspan]="card.cols" [rowspan]="card.rows"> | ||
<mat-card class="dashboard-card"> | ||
<mat-card-header> | ||
<mat-card-title> | ||
{{card.title}} | ||
<button mat-icon-button class="more-button" [matMenuTriggerFor]="menu" aria-label="Toggle menu"> | ||
<mat-icon>more_vert</mat-icon> | ||
</button> | ||
<mat-menu #menu="matMenu" xPosition="before"> | ||
<button mat-menu-item>Expand</button> | ||
<button mat-menu-item>Remove</button> | ||
</mat-menu> | ||
</mat-card-title> | ||
</mat-card-header> | ||
<mat-card-content class="dashboard-card-content"> | ||
<div>Card Content Here</div> | ||
</mat-card-content> | ||
</mat-card> | ||
</mat-grid-tile> | ||
} | ||
</mat-grid-list> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hi! Shouldn't the track use something like "track state.abbreviation" here?