diff --git a/guides/creating-a-custom-stepper-using-the-cdk-stepper.md b/guides/creating-a-custom-stepper-using-the-cdk-stepper.md index 615f241950dd..c116bfb92f40 100644 --- a/guides/creating-a-custom-stepper-using-the-cdk-stepper.md +++ b/guides/creating-a-custom-stepper-using-the-cdk-stepper.md @@ -45,14 +45,11 @@ This is the HTML template of our custom stepper component: @@ -117,9 +114,11 @@ If you want to iterate over your steps and use your own custom component you can ```html - - - + @for (step of mySteps; track step) { + + + + } ``` diff --git a/src/cdk-experimental/popover-edit/popover-edit.spec.ts b/src/cdk-experimental/popover-edit/popover-edit.spec.ts index 950c572cc538..7a7b0bd1a605 100644 --- a/src/cdk-experimental/popover-edit/popover-edit.spec.ts +++ b/src/cdk-experimental/popover-edit/popover-edit.spec.ts @@ -194,18 +194,20 @@ abstract class BaseTestComponent { ${WEIGHT_EDIT_TEMPLATE} - - just a cell - - - ${CELL_TEMPLATE} - - - - {{element.weight}} - - + @for (element of elements; track element) { + + just a cell + + + ${CELL_TEMPLATE} + + + + {{element.weight}} + + + } `, }) @@ -220,25 +222,27 @@ class VanillaTableOutOfCell extends BaseTestComponent { @Component({ template: ` - - + @for (element of elements; track element) { + + - + + ${NAME_EDIT_TEMPLATE} + + - - + + ${WEIGHT_EDIT_TEMPLATE} + + + + }
just a cell
just a cell - ${CELL_TEMPLATE} + + ${CELL_TEMPLATE} - - ${NAME_EDIT_TEMPLATE} - - - {{element.weight}} + + {{element.weight}} - - ${WEIGHT_EDIT_TEMPLATE} - -
`, }) diff --git a/src/cdk-experimental/selection/selection.spec.ts b/src/cdk-experimental/selection/selection.spec.ts index 0a15f2bd45d1..757ee64cd85e 100644 --- a/src/cdk-experimental/selection/selection.spec.ts +++ b/src/cdk-experimental/selection/selection.spec.ts @@ -442,15 +442,17 @@ describe('cdkSelectionColumn with multiple = false', () => { -
  • - - {{item}} -
  • + @for (item of data; track item; let i = $index) { +
  • + + {{item}} +
  • + } `, }) class ListWithMultiSelection { @@ -460,7 +462,10 @@ class ListWithMultiSelection { selectionChange?: SelectionChange; - constructor(private readonly _elementRef: ElementRef, private readonly _cdr: ChangeDetectorRef) {} + constructor( + private readonly _elementRef: ElementRef, + private readonly _cdr: ChangeDetectorRef, + ) {} selectAllState(indeterminateState: boolean | null, checkedState: boolean | null): string { if (indeterminateState) { @@ -502,15 +507,17 @@ class ListWithMultiSelection { template: ` `, }) class ListWithSingleSelection { @@ -530,7 +537,10 @@ class ListWithSingleSelection { this._cdr.detectChanges(); } - constructor(private readonly _elementRef: ElementRef, private readonly _cdr: ChangeDetectorRef) {} + constructor( + private readonly _elementRef: ElementRef, + private readonly _cdr: ChangeDetectorRef, + ) {} getSelectionToggle(index: number) { return this._elementRef.nativeElement.querySelectorAll('[cdkselectiontoggle]')[index]; @@ -585,7 +595,10 @@ class MultiSelectTableWithSelectionColumn { this._cdr.detectChanges(); } - constructor(readonly elementRef: ElementRef, private readonly _cdr: ChangeDetectorRef) {} + constructor( + readonly elementRef: ElementRef, + private readonly _cdr: ChangeDetectorRef, + ) {} getSelectAll(): HTMLInputElement { return this.elementRef.nativeElement.querySelector('input[cdkselectall]'); @@ -632,7 +645,10 @@ class SingleSelectTableWithSelectionColumn { this._cdr.detectChanges(); } - constructor(readonly elementRef: ElementRef, private readonly _cdr: ChangeDetectorRef) {} + constructor( + readonly elementRef: ElementRef, + private readonly _cdr: ChangeDetectorRef, + ) {} getSelectionToggle(index: number): HTMLInputElement { return this.elementRef.nativeElement.querySelectorAll('input[cdkselectiontoggle]')[index]; diff --git a/src/cdk-experimental/table-scroll-container/table-scroll-container.spec.ts b/src/cdk-experimental/table-scroll-container/table-scroll-container.spec.ts index 1c152347c069..4fffaff7cfc9 100644 --- a/src/cdk-experimental/table-scroll-container/table-scroll-container.spec.ts +++ b/src/cdk-experimental/table-scroll-container/table-scroll-container.spec.ts @@ -247,13 +247,15 @@ class FakeDataSource extends DataSource { template: `
    - - - - - + @for (column of columns; track column) { + + + + + + } diff --git a/src/cdk/a11y/focus-trap/focus-trap.spec.ts b/src/cdk/a11y/focus-trap/focus-trap.spec.ts index 7c8bbfe0b76d..6038356b930a 100644 --- a/src/cdk/a11y/focus-trap/focus-trap.spec.ts +++ b/src/cdk/a11y/focus-trap/focus-trap.spec.ts @@ -339,10 +339,12 @@ class SimpleFocusTrap { const AUTO_FOCUS_TEMPLATE = ` -
    - - -
    + @if (showTrappedRegion) { +
    + + +
    + } `; @Component({template: AUTO_FOCUS_TEMPLATE}) @@ -360,11 +362,13 @@ class FocusTrapWithAutoCaptureInShadowDom extends FocusTrapWithAutoCapture {} @Component({ template: ` -
    - - -
    - `, + @if (renderFocusTrap) { +
    + + +
    + } + `, }) class FocusTrapWithBindings { @ViewChild(CdkTrapFocus) focusTrapDirective: CdkTrapFocus; diff --git a/src/cdk/drag-drop/directives/drag.spec.ts b/src/cdk/drag-drop/directives/drag.spec.ts index 8c5ca6a3d05b..3398aed91e2e 100644 --- a/src/cdk/drag-drop/directives/drag.spec.ts +++ b/src/cdk/drag-drop/directives/drag.spec.ts @@ -6,7 +6,7 @@ import { dispatchMouseEvent, dispatchTouchEvent, dispatchFakeEvent, -} from '../../testing/private'; +} from '@angular/cdk/testing/private'; import { AfterViewInit, ChangeDetectionStrategy, @@ -6725,10 +6725,11 @@ class StandaloneDraggableWithPreDisabledHandle { template: `
    -
    + @if (showHandle) { +
    + }
    `, }) @@ -6806,6 +6807,7 @@ class StandaloneDraggableWithMultipleHandles { @ViewChildren(CdkDragHandle) handles: QueryList; } +// TODO(crisbeto): figure out why switch `*ngFor` with `@for` here causes a test failure. const DROP_ZONE_FIXTURE_TEMPLATE = `
    - -
    {{item.value}}
    -
    + @if (true) { + @for (item of items; track item) { +
    {{item.value}}
    + } + }
    `, }) @@ -6993,12 +6996,13 @@ const HORIZONTAL_FIXTURE_TEMPLATE = ` cdkDropListOrientation="horizontal" [cdkDropListData]="items" (cdkDropListDropped)="droppedSpy($event)"> -
    {{item.value}}
    + @for (item of items; track item) { +
    {{item.value}}
    + } `; @@ -7058,26 +7062,29 @@ class DraggableInScrollableHorizontalDropZone extends DraggableInHorizontalDropZ } } +// TODO(crisbeto): `*ngIf` here can be removed after updating to a version of Angular that includes +// https://github.com/angular/angular/pull/52515 @Component({ template: `
    -
    - {{item}} - - - -
    Custom preview
    -
    -
    -
    + @for (item of items; track item) { +
    + {{item}} + + + +
    Custom preview
    +
    +
    +
    + }
    `, }) @@ -7095,15 +7102,16 @@ class DraggableInDropZoneWithCustomPreview { @Component({ template: `
    -
    - {{item}} - Hello {{item}} -
    + @for (item of items; track item) { +
    + {{item}} + Hello {{item}} +
    + }
    `, }) @@ -7116,16 +7124,15 @@ class DraggableInDropZoneWithCustomTextOnlyPreview { @Component({ template: `
    -
    + @for (item of items; track item) { +
    {{item}} Hello {{item}} -
    +
    + }
    `, }) @@ -7141,16 +7148,17 @@ class DraggableInDropZoneWithCustomMultiNodePreview { cdkDropList (cdkDropListDropped)="droppedSpy($event)" style="width: 100px; background: pink;"> -
    + @for (item of items; track item) { +
    {{item}} - + @if (renderPlaceholder) {
    Custom placeholder
    -
    -
    + } +
    + } `, styles: [ @@ -7172,11 +7180,12 @@ class DraggableInDropZoneWithCustomPlaceholder { @Component({ template: `
    -
    + @for (item of items; track item) { +
    {{item}} Hello {{item}} -
    +
    + }
    `, }) @@ -7188,14 +7197,15 @@ class DraggableInDropZoneWithCustomTextOnlyPlaceholder { @Component({ template: `
    -
    + @for (item of items; track item) { +
    {{item}} Hello {{item}} -
    +
    + }
    `, }) @@ -7229,11 +7239,12 @@ const CONNECTED_DROP_ZONES_TEMPLATE = ` [cdkDropListConnectedTo]="[doneZone]" (cdkDropListDropped)="droppedSpy($event)" (cdkDropListEntered)="enteredSpy($event)"> -
    {{item}}
    + @for (item of todo; track item) { +
    {{item}}
    + }
    -
    {{item}}
    + @for (item of done; track item) { +
    {{item}}
    + }
    -
    {{item}}
    + @for (item of extra; track item) { +
    {{item}}
    + }
    `; @@ -7295,7 +7308,7 @@ class ConnectedDropZones implements AfterViewInit { @Component({ encapsulation: ViewEncapsulation.ShadowDom, styles: CONNECTED_DROP_ZONES_STYLES, - template: `
    ${CONNECTED_DROP_ZONES_TEMPLATE}
    `, + template: `@if (true) {${CONNECTED_DROP_ZONES_TEMPLATE}}`, }) class ConnectedDropZonesInsideShadowRootWithNgIf extends ConnectedDropZones {} @@ -7323,14 +7336,18 @@ class ConnectedDropZonesInsideShadowRootWithNgIf extends ConnectedDropZones {} cdkDropList [cdkDropListData]="todo" (cdkDropListDropped)="droppedSpy($event)"> -
    {{item}}
    + @for (item of todo; track item) { +
    {{item}}
    +}
    -
    {{item}}
    + @for (item of done; track item) { +
    {{item}}
    + }
    `, @@ -7445,10 +7462,12 @@ class DropListOnNgContainer {} changeDetection: ChangeDetectionStrategy.OnPush, template: `
    -
    {{item.value}}
    + @for (item of items; track item) { +
    {{item.value}}
    + }
    `, }) @@ -7503,16 +7522,17 @@ class ConnectedWrappedDropZones { [cdkDropListData]="items" (cdkDropListSorted)="sortedSpy($event)" (cdkDropListDropped)="droppedSpy($event)"> -
    - {{item.value}} - -
    + @for (item of items; track item) { +
    + {{item.value}} + +
    + } `, }) @@ -7546,16 +7566,17 @@ class DraggableWithCanvasInDropZone extends DraggableInDropZone implements After [cdkDropListData]="items" (cdkDropListSorted)="sortedSpy($event)" (cdkDropListDropped)="droppedSpy($event)"> -
    - {{item.value}} - -
    + @for (item of items; track item) { +
    + {{item.value}} + +
    + } `, }) @@ -7576,7 +7597,9 @@ class PassthroughComponent {} selector: 'wrapped-drop-container', template: `
    -
    {{item}}
    + @for (item of items; track item) { +
    {{item}}
    + }
    `, changeDetection: ChangeDetectionStrategy.OnPush, @@ -7695,10 +7718,11 @@ class NestedDragsThroughTemplate { template: `
    -
    {{item}}
    + @for (item of items; track item) { +
    {{item}}
    + }
    `, @@ -7743,13 +7767,14 @@ class PlainStandaloneDropList { ], template: `
    -
    - {{item}} - - -
    {{item}}
    -
    -
    + @for (item of items; track item) { +
    + {{item}} + +
    {{item}}
    +
    +
    + }
    `, }) @@ -7768,11 +7793,12 @@ class DraggableInHorizontalFlexDropZoneWithMatchSizePreview { [cdkDropListConnectedTo]="[doneZone]" (cdkDropListDropped)="droppedSpy($event)" (cdkDropListEntered)="enteredSpy($event)"> -
    {{item}}
    + @for (item of todo; track item) { +
    {{item}}
    + }
    Hello there
    -
    {{item}}
    + @for (item of done; track item) { +
    {{item}}
    + }
    `, @@ -7824,21 +7851,22 @@ class DraggableWithAlternateRootAndSelfHandle { [cdkDropListData]="items" (cdkDropListSorted)="sortedSpy($event)" (cdkDropListDropped)="droppedSpy($event)"> -
    - {{item.value}} - - - -
    + @for (item of items; track item) { +
    + {{item.value}} + + + +
    + } `, }) @@ -7852,13 +7880,14 @@ class DraggableWithInputsInDropZone extends DraggableInDropZone { cdkDropList class="drop-list scroll-container" [cdkDropListData]="items"> -
    - {{item.id}} - -
    + @for (item of items; track item) { +
    + {{item.id}} + +
    + } `, }) diff --git a/src/cdk/drag-drop/drag-drop.md b/src/cdk/drag-drop/drag-drop.md index 0c955660e0e1..bb8438e525d9 100644 --- a/src/cdk/drag-drop/drag-drop.md +++ b/src/cdk/drag-drop/drag-drop.md @@ -46,7 +46,9 @@ will be connected to all other lists automatically. ```html
    -
    + @for (list of lists; track list) { +
    + }
    ``` @@ -58,9 +60,13 @@ or `cdkDropListData`, respectively. Events fired from both directives include th you to easily identify the origin of the drag or drop interaction. ```html -
    -
    -
    +@for (list of lists; track list) { +
    + @for (item of list; track item) { +
    + } +
    +} ``` ### Styling diff --git a/src/cdk/listbox/listbox.spec.ts b/src/cdk/listbox/listbox.spec.ts index 3a75f90bdb2d..a7a2c9837ce1 100644 --- a/src/cdk/listbox/listbox.spec.ts +++ b/src/cdk/listbox/listbox.spec.ts @@ -1004,7 +1004,9 @@ class ListboxWithFormControl { @Component({ template: `
    -
    {{option}}
    + @for (option of options; track option) { +
    {{option}}
    + }
    `, }) @@ -1016,7 +1018,9 @@ class ListboxWithPreselectedFormControl { @Component({ template: `
    -
    {{option}}
    + @for (option of options; track option) { +
    {{option}}
    + }
    `, }) @@ -1071,7 +1075,9 @@ class ListboxWithMultipleBoundValues { @Component({ template: `
    -
    {{fruit.name}}
    + @for (fruit of fruits; track fruit) { +
    {{fruit.name}}
    + }
    `, }) diff --git a/src/cdk/menu/pointer-focus-tracker.spec.ts b/src/cdk/menu/pointer-focus-tracker.spec.ts index 0e8c2ca43467..afa8f7ddc3e2 100644 --- a/src/cdk/menu/pointer-focus-tracker.spec.ts +++ b/src/cdk/menu/pointer-focus-tracker.spec.ts @@ -108,7 +108,9 @@ class MockWrapper implements FocusableElement {
    First Second - Third + @if (showThird) { + Third + }
    `, }) diff --git a/src/cdk/portal/portal.spec.ts b/src/cdk/portal/portal.spec.ts index 2ac61c3cd067..df20e496453c 100644 --- a/src/cdk/portal/portal.spec.ts +++ b/src/cdk/portal/portal.spec.ts @@ -779,7 +779,10 @@ class ArbitraryViewContainerRefComponent { @ViewChild('template') template: TemplateRef; @ViewChild(SaveParentNodeOnInit) saveParentNodeOnInit: SaveParentNodeOnInit; - constructor(public viewContainerRef: ViewContainerRef, public injector: Injector) {} + constructor( + public viewContainerRef: ViewContainerRef, + public injector: Injector, + ) {} } /** Test-bed component that contains a portal outlet and a couple of template portals. */ @@ -799,7 +802,9 @@ class ArbitraryViewContainerRefComponent {
      -
    • {{fruitName}}
    • + @for (fruitName of fruits; track fruitName) { +
    • {{fruitName}}
    • + }
    @@ -825,7 +830,10 @@ class PortalTestApp { fruits = ['Apple', 'Pineapple', 'Durian']; attachedSpy = jasmine.createSpy('attached spy'); - constructor(public viewContainerRef: ViewContainerRef, public injector: Injector) {} + constructor( + public viewContainerRef: ViewContainerRef, + public injector: Injector, + ) {} get cakePortal() { return this.portals.first; diff --git a/src/cdk/scrolling/virtual-scroll-viewport.spec.ts b/src/cdk/scrolling/virtual-scroll-viewport.spec.ts index c61ec400f7d9..0b623dd0e36f 100644 --- a/src/cdk/scrolling/virtual-scroll-viewport.spec.ts +++ b/src/cdk/scrolling/virtual-scroll-viewport.spec.ts @@ -1419,9 +1419,9 @@ class VirtualScrollWithItemInjectingViewContainer { @Component({ template: ` - + @if (renderVirtualFor) {
    {{item}}
    -
    + }
    `, styles: [ diff --git a/src/cdk/table/table.spec.ts b/src/cdk/table/table.spec.ts index 798e41234f4f..1ac2f5cb3dce 100644 --- a/src/cdk/table/table.spec.ts +++ b/src/cdk/table/table.spec.ts @@ -2419,13 +2419,15 @@ class StickyPositioningListenerTest implements StickyPositioningListener { @Component({ template: ` - - Header {{column}} - {{column}} - Footer {{column}} - + @for (column of columns; track column) { + + Header {{column}} + {{column}} + Footer {{column}} + + } @@ -2477,13 +2479,15 @@ class StickyFlexLayoutCdkTableApp extends StickyPositioningListenerTest { @Component({ template: `
    Header {{column}} {{column}} Footer {{column}} Header {{column}} {{column}} Footer {{column}}
    - - - - - + @for (column of columns; track column) { + + + + + + } @@ -2532,10 +2536,12 @@ class StickyNativeLayoutCdkTableApp extends StickyPositioningListenerTest { @Component({ template: ` - - {{column}} - {{column}} - + @for (column of dynamicColumns; track column) { + + {{column}} + {{column}} + + } @@ -3007,15 +3013,15 @@ class NativeHtmlTableWithColgroupAndCol { } @Component({ - // Note that we need the `ngSwitch` below in order to surface the issue we're testing for. + // Note that we need the `@if` below in order to surface the issue we're testing for. template: ` - + @if (true) { Column A {{row.a}} - + } diff --git a/src/cdk/testing/tests/test-main-component.html b/src/cdk/testing/tests/test-main-component.html index 8ec6080aa042..263f6d235b5c 100644 --- a/src/cdk/testing/tests/test-main-component.html +++ b/src/cdk/testing/tests/test-main-component.html @@ -74,7 +74,9 @@

    Main Component

    - +@if (_shadowDomSupported) { + +}
    List of {{title}}
      -
    • {{item}}
    • + @for (item of items; track item) { +
    • {{item}}
    • + }
    `, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, diff --git a/src/cdk/tree/tree.spec.ts b/src/cdk/tree/tree.spec.ts index fa6cff0a4075..c2c9e6abe55f 100644 --- a/src/cdk/tree/tree.spec.ts +++ b/src/cdk/tree/tree.spec.ts @@ -1383,13 +1383,13 @@ class SimpleCdkTreeApp { @Component({ template: ` - + @if (true) { {{node.pizzaTopping}} - {{node.pizzaCheese}} + {{node.pizzaBase}} - + } `, }) @@ -1500,9 +1500,11 @@ class CdkTreeAppWithToggle { {{node.pizzaTopping}} - {{node.pizzaCheese}} + {{node.pizzaBase}} -
    + @if (treeControl.isExpanded(node)) { +
    +} `, diff --git a/src/components-examples/cdk-experimental/popover-edit/cdk-popover-edit-cell-span-vanilla-table/cdk-popover-edit-cell-span-vanilla-table-example.html b/src/components-examples/cdk-experimental/popover-edit/cdk-popover-edit-cell-span-vanilla-table/cdk-popover-edit-cell-span-vanilla-table-example.html index df7be8b086d4..d2fb0ff05f3b 100644 --- a/src/components-examples/cdk-experimental/popover-edit/cdk-popover-edit-cell-span-vanilla-table/cdk-popover-edit-cell-span-vanilla-table-example.html +++ b/src/components-examples/cdk-experimental/popover-edit/cdk-popover-edit-cell-span-vanilla-table/cdk-popover-edit-cell-span-vanilla-table-example.html @@ -26,45 +26,47 @@
    - +
    - - - - - - - - - + @for (person of persons; track person) { + + + + + + + + + + }
    Header {{column}} {{column}} Footer {{column}} Header {{column}} {{column}} Footer {{column}}
    No. First name Middle name Last name
    {{person.id}} - {{person.firstName}} - - - - - - {{person.middleName}} - - - - - - {{person.lastName}} - - - - -
    {{person.id}} + {{person.firstName}} + + + + + + {{person.middleName}} + + + + + + {{person.lastName}} + + + + +
    diff --git a/src/components-examples/cdk-experimental/popover-edit/cdk-popover-edit-cell-span-vanilla-table/cdk-popover-edit-cell-span-vanilla-table-example.ts b/src/components-examples/cdk-experimental/popover-edit/cdk-popover-edit-cell-span-vanilla-table/cdk-popover-edit-cell-span-vanilla-table-example.ts index f3fa86f5b5a5..d0168c103ca0 100644 --- a/src/components-examples/cdk-experimental/popover-edit/cdk-popover-edit-cell-span-vanilla-table/cdk-popover-edit-cell-span-vanilla-table-example.ts +++ b/src/components-examples/cdk-experimental/popover-edit/cdk-popover-edit-cell-span-vanilla-table/cdk-popover-edit-cell-span-vanilla-table-example.ts @@ -1,6 +1,5 @@ import {Component} from '@angular/core'; import {NgForm, FormsModule} from '@angular/forms'; -import {NgFor} from '@angular/common'; import {CdkPopoverEditModule} from '@angular/cdk-experimental/popover-edit'; export interface Person { @@ -30,7 +29,7 @@ const PERSON_DATA: Person[] = [ styleUrls: ['cdk-popover-edit-cell-span-vanilla-table-example.css'], templateUrl: 'cdk-popover-edit-cell-span-vanilla-table-example.html', standalone: true, - imports: [CdkPopoverEditModule, FormsModule, NgFor], + imports: [CdkPopoverEditModule, FormsModule], }) export class CdkPopoverEditCellSpanVanillaTableExample { readonly preservedValues = new WeakMap(); diff --git a/src/components-examples/cdk-experimental/popover-edit/cdk-popover-edit-tab-out-vanilla-table/cdk-popover-edit-tab-out-vanilla-table-example.html b/src/components-examples/cdk-experimental/popover-edit/cdk-popover-edit-tab-out-vanilla-table/cdk-popover-edit-tab-out-vanilla-table-example.html index 13270f0a01f0..dcd780c5a16e 100644 --- a/src/components-examples/cdk-experimental/popover-edit/cdk-popover-edit-tab-out-vanilla-table/cdk-popover-edit-tab-out-vanilla-table-example.html +++ b/src/components-examples/cdk-experimental/popover-edit/cdk-popover-edit-tab-out-vanilla-table/cdk-popover-edit-tab-out-vanilla-table-example.html @@ -15,42 +15,44 @@
    - + No. Name Weight Symbol - - - {{element.position}} - - - {{element.name}} - - - -
    -
    - -
    - -
    -
    -
    - - - {{element.weight}} - + @for (element of elements; track element) { + + {{element.position}} - {{element.symbol}} - + + {{element.name}} + + + +
    +
    + +
    + +
    +
    +
    + + + + {{element.weight}} + + + {{element.symbol}} + + } diff --git a/src/components-examples/cdk-experimental/popover-edit/cdk-popover-edit-tab-out-vanilla-table/cdk-popover-edit-tab-out-vanilla-table-example.ts b/src/components-examples/cdk-experimental/popover-edit/cdk-popover-edit-tab-out-vanilla-table/cdk-popover-edit-tab-out-vanilla-table-example.ts index 322b160cb655..bb3fc4379565 100644 --- a/src/components-examples/cdk-experimental/popover-edit/cdk-popover-edit-tab-out-vanilla-table/cdk-popover-edit-tab-out-vanilla-table-example.ts +++ b/src/components-examples/cdk-experimental/popover-edit/cdk-popover-edit-tab-out-vanilla-table/cdk-popover-edit-tab-out-vanilla-table-example.ts @@ -1,6 +1,5 @@ import {Component} from '@angular/core'; import {NgForm, FormsModule} from '@angular/forms'; -import {NgFor} from '@angular/common'; import {CdkPopoverEditModule} from '@angular/cdk-experimental/popover-edit'; export interface PeriodicElement { @@ -41,7 +40,7 @@ const ELEMENT_DATA: PeriodicElement[] = [ styleUrls: ['cdk-popover-edit-tab-out-vanilla-table-example.css'], templateUrl: 'cdk-popover-edit-tab-out-vanilla-table-example.html', standalone: true, - imports: [CdkPopoverEditModule, FormsModule, NgFor], + imports: [CdkPopoverEditModule, FormsModule], }) export class CdkPopoverEditTabOutVanillaTableExample { readonly preservedNameValues = new WeakMap(); diff --git a/src/components-examples/cdk-experimental/popover-edit/cdk-popover-edit-vanilla-table/cdk-popover-edit-vanilla-table-example.html b/src/components-examples/cdk-experimental/popover-edit/cdk-popover-edit-vanilla-table/cdk-popover-edit-vanilla-table-example.html index fe4d4dbd7912..4facc8c21aa5 100644 --- a/src/components-examples/cdk-experimental/popover-edit/cdk-popover-edit-vanilla-table/cdk-popover-edit-vanilla-table-example.html +++ b/src/components-examples/cdk-experimental/popover-edit/cdk-popover-edit-vanilla-table/cdk-popover-edit-vanilla-table-example.html @@ -19,51 +19,53 @@ - + No. Name Weight Symbol - - - {{element.position}} - - - {{element.name}} - - - -
    -
    - Edit a: - -
    - - - -
    -
    -
    - - - - + @for (element of elements; track element) { + + {{element.position}} - - {{element.weight}} - - - - - + + {{element.name}} - {{element.symbol}} - + + +
    +
    + Edit a: + +
    + + + +
    +
    +
    + + + + + + + + {{element.weight}} + + + + + + + {{element.symbol}} + + } diff --git a/src/components-examples/cdk-experimental/popover-edit/cdk-popover-edit-vanilla-table/cdk-popover-edit-vanilla-table-example.ts b/src/components-examples/cdk-experimental/popover-edit/cdk-popover-edit-vanilla-table/cdk-popover-edit-vanilla-table-example.ts index 7309eb186543..0e3c9f5e7cf2 100644 --- a/src/components-examples/cdk-experimental/popover-edit/cdk-popover-edit-vanilla-table/cdk-popover-edit-vanilla-table-example.ts +++ b/src/components-examples/cdk-experimental/popover-edit/cdk-popover-edit-vanilla-table/cdk-popover-edit-vanilla-table-example.ts @@ -1,6 +1,5 @@ import {Component} from '@angular/core'; import {NgForm, FormsModule} from '@angular/forms'; -import {NgFor} from '@angular/common'; import {CdkPopoverEditModule} from '@angular/cdk-experimental/popover-edit'; export interface PeriodicElement { @@ -41,7 +40,7 @@ const ELEMENT_DATA: PeriodicElement[] = [ styleUrls: ['cdk-popover-edit-vanilla-table-example.css'], templateUrl: 'cdk-popover-edit-vanilla-table-example.html', standalone: true, - imports: [CdkPopoverEditModule, FormsModule, NgFor], + imports: [CdkPopoverEditModule, FormsModule], }) export class CdkPopoverEditVanillaTableExample { readonly preservedNameValues = new WeakMap(); diff --git a/src/components-examples/cdk-experimental/selection/cdk-selection-list/cdk-selection-list-example.html b/src/components-examples/cdk-experimental/selection/cdk-selection-list/cdk-selection-list-example.html index 8877ac3e1b25..610b3453d34f 100644 --- a/src/components-examples/cdk-experimental/selection/cdk-selection-list/cdk-selection-list-example.html +++ b/src/components-examples/cdk-experimental/selection/cdk-selection-list/cdk-selection-list-example.html @@ -5,40 +5,48 @@

    native input

    [checked]="allToggler.checked | async" [indeterminate]="allToggler.indeterminate | async" (click)="allToggler.toggle($event)"> -
  • - - {{item}} -
  • + @for (item of data; track item) { +
  • + + {{item}} +
  • + }

    mat-checkbox

    Selected: {{selected2}}
      -
    • - - {{item}} -
    • + @for (item of data; track item) { +
    • + + {{item}} +
    • + }

    Single select with mat-checkbox

    Selected: {{selected3}}
      -
    • - - {{item}} -
    • + @for (item of data; track item) { +
    • + + {{item}} +
    • + }

    with trackBy

    Selected: {{selected4}}
      -
    • - - {{item}} -
    • + @for (item of data; track trackByFn($index)) { +
    • + + {{item}} +
    • + }
    diff --git a/src/components-examples/cdk-experimental/selection/cdk-selection-list/cdk-selection-list-example.ts b/src/components-examples/cdk-experimental/selection/cdk-selection-list/cdk-selection-list-example.ts index ea93bffe5a8a..ab0dedf7f6e6 100644 --- a/src/components-examples/cdk-experimental/selection/cdk-selection-list/cdk-selection-list-example.ts +++ b/src/components-examples/cdk-experimental/selection/cdk-selection-list/cdk-selection-list-example.ts @@ -1,5 +1,5 @@ import {Component} from '@angular/core'; -import {NgFor, AsyncPipe} from '@angular/common'; +import {AsyncPipe} from '@angular/common'; import {SelectionChange, CdkSelectionModule} from '@angular/cdk-experimental/selection'; import {MatCheckboxModule} from '@angular/material/checkbox'; @@ -10,7 +10,7 @@ import {MatCheckboxModule} from '@angular/material/checkbox'; selector: 'cdk-selection-list-example', templateUrl: 'cdk-selection-list-example.html', standalone: true, - imports: [CdkSelectionModule, NgFor, MatCheckboxModule, AsyncPipe], + imports: [CdkSelectionModule, MatCheckboxModule, AsyncPipe], }) export class CdkSelectionListExample { data = ELEMENT_NAMES; diff --git a/src/components-examples/cdk/accordion/cdk-accordion-overview/cdk-accordion-overview-example.html b/src/components-examples/cdk/accordion/cdk-accordion-overview/cdk-accordion-overview-example.html index 0a02078fd51a..984d85a30d29 100644 --- a/src/components-examples/cdk/accordion/cdk-accordion-overview/cdk-accordion-overview-example.html +++ b/src/components-examples/cdk/accordion/cdk-accordion-overview/cdk-accordion-overview-example.html @@ -1,29 +1,31 @@ - -
    - {{ item }} - - Click to {{ accordionItem.expanded ? 'close' : 'open' }} - -
    -
    - Lorem ipsum dolor, sit amet consectetur adipisicing elit. Perferendis - excepturi incidunt ipsum deleniti labore, tempore non nam doloribus blanditiis - veritatis illo autem iure aliquid ullam rem tenetur deserunt velit culpa? -
    -
    + @for (item of items; track item; let index = $index) { + +
    + {{ item }} + + Click to {{ accordionItem.expanded ? 'close' : 'open' }} + +
    +
    + Lorem ipsum dolor, sit amet consectetur adipisicing elit. Perferendis + excepturi incidunt ipsum deleniti labore, tempore non nam doloribus blanditiis + veritatis illo autem iure aliquid ullam rem tenetur deserunt velit culpa? +
    +
    + }
    diff --git a/src/components-examples/cdk/accordion/cdk-accordion-overview/cdk-accordion-overview-example.ts b/src/components-examples/cdk/accordion/cdk-accordion-overview/cdk-accordion-overview-example.ts index 8210e1e591a5..2a6f6d75f3af 100644 --- a/src/components-examples/cdk/accordion/cdk-accordion-overview/cdk-accordion-overview-example.ts +++ b/src/components-examples/cdk/accordion/cdk-accordion-overview/cdk-accordion-overview-example.ts @@ -1,5 +1,4 @@ import {Component} from '@angular/core'; -import {NgFor} from '@angular/common'; import {CdkAccordionModule} from '@angular/cdk/accordion'; /** @@ -10,7 +9,7 @@ import {CdkAccordionModule} from '@angular/cdk/accordion'; templateUrl: 'cdk-accordion-overview-example.html', styleUrls: ['cdk-accordion-overview-example.css'], standalone: true, - imports: [CdkAccordionModule, NgFor], + imports: [CdkAccordionModule], }) export class CdkAccordionOverviewExample { items = ['Item 1', 'Item 2', 'Item 3', 'Item 4', 'Item 5']; diff --git a/src/components-examples/cdk/dialog/cdk-dialog-data/cdk-dialog-data-example-dialog.html b/src/components-examples/cdk/dialog/cdk-dialog-data/cdk-dialog-data-example-dialog.html index 80957156217c..ed8e220bd62f 100644 --- a/src/components-examples/cdk/dialog/cdk-dialog-data/cdk-dialog-data-example-dialog.html +++ b/src/components-examples/cdk/dialog/cdk-dialog-data/cdk-dialog-data-example-dialog.html @@ -3,13 +3,19 @@

    Favorite Animal

    My favorite animal is:
    • - Panda + @if (data.animal === 'panda') { + + } Panda
    • - Unicorn + @if (data.animal === 'unicorn') { + + } Unicorn
    • - Lion + @if (data.animal === 'lion') { + + } Lion
    diff --git a/src/components-examples/cdk/dialog/cdk-dialog-data/cdk-dialog-data-example.ts b/src/components-examples/cdk/dialog/cdk-dialog-data/cdk-dialog-data-example.ts index eae2408e86a5..105ad82c6191 100644 --- a/src/components-examples/cdk/dialog/cdk-dialog-data/cdk-dialog-data-example.ts +++ b/src/components-examples/cdk/dialog/cdk-dialog-data/cdk-dialog-data-example.ts @@ -1,6 +1,5 @@ import {Component, Inject} from '@angular/core'; import {Dialog, DIALOG_DATA, DialogModule} from '@angular/cdk/dialog'; -import {NgIf} from '@angular/common'; export interface DialogData { animal: 'panda' | 'unicorn' | 'lion'; @@ -33,7 +32,6 @@ export class CdkDialogDataExample { templateUrl: 'cdk-dialog-data-example-dialog.html', styleUrls: ['./cdk-dialog-data-example-dialog.css'], standalone: true, - imports: [NgIf], }) export class CdkDialogDataExampleDialog { constructor(@Inject(DIALOG_DATA) public data: DialogData) {} diff --git a/src/components-examples/cdk/dialog/cdk-dialog-overview/cdk-dialog-overview-example.html b/src/components-examples/cdk/dialog/cdk-dialog-overview/cdk-dialog-overview-example.html index 80f3adcbf9e3..8bc87d66ac56 100644 --- a/src/components-examples/cdk/dialog/cdk-dialog-overview/cdk-dialog-overview-example.html +++ b/src/components-examples/cdk/dialog/cdk-dialog-overview/cdk-dialog-overview-example.html @@ -6,7 +6,9 @@
  • -
  • - You chose: {{animal}} -
  • + @if (animal) { +
  • + You chose: {{animal}} +
  • + } diff --git a/src/components-examples/cdk/dialog/cdk-dialog-overview/cdk-dialog-overview-example.ts b/src/components-examples/cdk/dialog/cdk-dialog-overview/cdk-dialog-overview-example.ts index 49828936cdd4..b6cc17829dea 100644 --- a/src/components-examples/cdk/dialog/cdk-dialog-overview/cdk-dialog-overview-example.ts +++ b/src/components-examples/cdk/dialog/cdk-dialog-overview/cdk-dialog-overview-example.ts @@ -1,6 +1,5 @@ import {Component, Inject} from '@angular/core'; import {Dialog, DialogRef, DIALOG_DATA, DialogModule} from '@angular/cdk/dialog'; -import {NgIf} from '@angular/common'; import {FormsModule} from '@angular/forms'; export interface DialogData { @@ -15,7 +14,7 @@ export interface DialogData { selector: 'cdk-dialog-overview-example', templateUrl: 'cdk-dialog-overview-example.html', standalone: true, - imports: [FormsModule, NgIf, DialogModule], + imports: [FormsModule, DialogModule], }) export class CdkDialogOverviewExample { animal: string | undefined; @@ -44,5 +43,8 @@ export class CdkDialogOverviewExample { imports: [FormsModule], }) export class CdkDialogOverviewExampleDialog { - constructor(public dialogRef: DialogRef, @Inject(DIALOG_DATA) public data: DialogData) {} + constructor( + public dialogRef: DialogRef, + @Inject(DIALOG_DATA) public data: DialogData, + ) {} } diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-connected-sorting-group/cdk-drag-drop-connected-sorting-group-example.html b/src/components-examples/cdk/drag-drop/cdk-drag-drop-connected-sorting-group/cdk-drag-drop-connected-sorting-group-example.html index edd8d80438ea..327ae1f986d9 100644 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-connected-sorting-group/cdk-drag-drop-connected-sorting-group-example.html +++ b/src/components-examples/cdk/drag-drop/cdk-drag-drop-connected-sorting-group/cdk-drag-drop-connected-sorting-group-example.html @@ -7,7 +7,9 @@

    To do

    [cdkDropListData]="todo" class="example-list" (cdkDropListDropped)="drop($event)"> -
    {{item}}
    + @for (item of todo; track item) { +
    {{item}}
    + } @@ -19,7 +21,9 @@

    Done

    [cdkDropListData]="done" class="example-list" (cdkDropListDropped)="drop($event)"> -
    {{item}}
    + @for (item of done; track item) { +
    {{item}}
    + } diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-connected-sorting-group/cdk-drag-drop-connected-sorting-group-example.ts b/src/components-examples/cdk/drag-drop/cdk-drag-drop-connected-sorting-group/cdk-drag-drop-connected-sorting-group-example.ts index 8b9396684dd6..cae54929724d 100644 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-connected-sorting-group/cdk-drag-drop-connected-sorting-group-example.ts +++ b/src/components-examples/cdk/drag-drop/cdk-drag-drop-connected-sorting-group/cdk-drag-drop-connected-sorting-group-example.ts @@ -1,5 +1,4 @@ import {Component} from '@angular/core'; -import {NgFor} from '@angular/common'; import { CdkDragDrop, CdkDrag, @@ -17,7 +16,7 @@ import { templateUrl: 'cdk-drag-drop-connected-sorting-group-example.html', styleUrls: ['cdk-drag-drop-connected-sorting-group-example.css'], standalone: true, - imports: [CdkDropListGroup, CdkDropList, NgFor, CdkDrag], + imports: [CdkDropListGroup, CdkDropList, CdkDrag], }) export class CdkDragDropConnectedSortingGroupExample { todo = ['Get to work', 'Pick up groceries', 'Go home', 'Fall asleep']; diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-connected-sorting/cdk-drag-drop-connected-sorting-example.html b/src/components-examples/cdk/drag-drop/cdk-drag-drop-connected-sorting/cdk-drag-drop-connected-sorting-example.html index ed67f2935414..44cd97cf460e 100644 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-connected-sorting/cdk-drag-drop-connected-sorting-example.html +++ b/src/components-examples/cdk/drag-drop/cdk-drag-drop-connected-sorting/cdk-drag-drop-connected-sorting-example.html @@ -8,7 +8,9 @@

    To do

    [cdkDropListConnectedTo]="[doneList]" class="example-list" (cdkDropListDropped)="drop($event)"> -
    {{item}}
    + @for (item of todo; track item) { +
    {{item}}
    + } @@ -22,7 +24,9 @@

    Done

    [cdkDropListConnectedTo]="[todoList]" class="example-list" (cdkDropListDropped)="drop($event)"> -
    {{item}}
    + @for (item of done; track item) { +
    {{item}}
    + } diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-connected-sorting/cdk-drag-drop-connected-sorting-example.ts b/src/components-examples/cdk/drag-drop/cdk-drag-drop-connected-sorting/cdk-drag-drop-connected-sorting-example.ts index 6287bb5c36a8..00055e1d5d17 100644 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-connected-sorting/cdk-drag-drop-connected-sorting-example.ts +++ b/src/components-examples/cdk/drag-drop/cdk-drag-drop-connected-sorting/cdk-drag-drop-connected-sorting-example.ts @@ -1,5 +1,4 @@ import {Component} from '@angular/core'; -import {NgFor} from '@angular/common'; import { CdkDragDrop, moveItemInArray, @@ -16,7 +15,7 @@ import { templateUrl: 'cdk-drag-drop-connected-sorting-example.html', styleUrls: ['cdk-drag-drop-connected-sorting-example.css'], standalone: true, - imports: [CdkDropList, NgFor, CdkDrag], + imports: [CdkDropList, CdkDrag], }) export class CdkDragDropConnectedSortingExample { todo = ['Get to work', 'Pick up groceries', 'Go home', 'Fall asleep']; diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-custom-placeholder/cdk-drag-drop-custom-placeholder-example.html b/src/components-examples/cdk/drag-drop/cdk-drag-drop-custom-placeholder/cdk-drag-drop-custom-placeholder-example.html index 68994b543234..f0673cd2abe7 100644 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-custom-placeholder/cdk-drag-drop-custom-placeholder-example.html +++ b/src/components-examples/cdk/drag-drop/cdk-drag-drop-custom-placeholder/cdk-drag-drop-custom-placeholder-example.html @@ -1,6 +1,8 @@
    -
    -
    - {{movie}} -
    + @for (movie of movies; track movie) { +
    +
    + {{movie}} +
    + }
    diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-custom-placeholder/cdk-drag-drop-custom-placeholder-example.ts b/src/components-examples/cdk/drag-drop/cdk-drag-drop-custom-placeholder/cdk-drag-drop-custom-placeholder-example.ts index 01d0ae213469..6ce72bc70a37 100644 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-custom-placeholder/cdk-drag-drop-custom-placeholder-example.ts +++ b/src/components-examples/cdk/drag-drop/cdk-drag-drop-custom-placeholder/cdk-drag-drop-custom-placeholder-example.ts @@ -6,7 +6,6 @@ import { CdkDropList, moveItemInArray, } from '@angular/cdk/drag-drop'; -import {NgFor} from '@angular/common'; /** * @title Drag&Drop custom placeholder @@ -16,7 +15,7 @@ import {NgFor} from '@angular/common'; templateUrl: 'cdk-drag-drop-custom-placeholder-example.html', styleUrls: ['cdk-drag-drop-custom-placeholder-example.css'], standalone: true, - imports: [CdkDropList, NgFor, CdkDrag, CdkDragPlaceholder], + imports: [CdkDropList, CdkDrag, CdkDragPlaceholder], }) export class CdkDragDropCustomPlaceholderExample { movies = [ diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-custom-preview/cdk-drag-drop-custom-preview-example.html b/src/components-examples/cdk/drag-drop/cdk-drag-drop-custom-preview/cdk-drag-drop-custom-preview-example.html index a6a717fb8746..5072331e4076 100644 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-custom-preview/cdk-drag-drop-custom-preview-example.html +++ b/src/components-examples/cdk/drag-drop/cdk-drag-drop-custom-preview/cdk-drag-drop-custom-preview-example.html @@ -1,6 +1,8 @@
    -
    - {{movie.title}} - -
    + @for (movie of movies; track movie) { +
    + {{movie.title}} + +
    + }
    diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-custom-preview/cdk-drag-drop-custom-preview-example.ts b/src/components-examples/cdk/drag-drop/cdk-drag-drop-custom-preview/cdk-drag-drop-custom-preview-example.ts index 05c81f1514cd..de89682ba474 100644 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-custom-preview/cdk-drag-drop-custom-preview-example.ts +++ b/src/components-examples/cdk/drag-drop/cdk-drag-drop-custom-preview/cdk-drag-drop-custom-preview-example.ts @@ -1,5 +1,4 @@ import {Component} from '@angular/core'; -import {NgFor} from '@angular/common'; import { CdkDragDrop, CdkDropList, @@ -16,7 +15,7 @@ import { templateUrl: 'cdk-drag-drop-custom-preview-example.html', styleUrls: ['cdk-drag-drop-custom-preview-example.css'], standalone: true, - imports: [CdkDropList, NgFor, CdkDrag, CdkDragPreview], + imports: [CdkDropList, CdkDrag, CdkDragPreview], }) export class CdkDragDropCustomPreviewExample { // tslint:disable:max-line-length diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-disabled-sorting/cdk-drag-drop-disabled-sorting-example.html b/src/components-examples/cdk/drag-drop/cdk-drag-drop-disabled-sorting/cdk-drag-drop-disabled-sorting-example.html index 1e9383b04beb..ee6b133d578b 100644 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-disabled-sorting/cdk-drag-drop-disabled-sorting-example.html +++ b/src/components-examples/cdk/drag-drop/cdk-drag-drop-disabled-sorting/cdk-drag-drop-disabled-sorting-example.html @@ -8,7 +8,9 @@

    Available items

    class="example-list" cdkDropListSortingDisabled (cdkDropListDropped)="drop($event)"> -
    {{item}}
    + @for (item of items; track item) { +
    {{item}}
    + } @@ -20,7 +22,9 @@

    Shopping basket

    [cdkDropListData]="basket" class="example-list" (cdkDropListDropped)="drop($event)"> -
    {{item}}
    + @for (item of basket; track item) { +
    {{item}}
    + } diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-disabled-sorting/cdk-drag-drop-disabled-sorting-example.ts b/src/components-examples/cdk/drag-drop/cdk-drag-drop-disabled-sorting/cdk-drag-drop-disabled-sorting-example.ts index 625e2dac3b88..5978eee1d5d0 100644 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-disabled-sorting/cdk-drag-drop-disabled-sorting-example.ts +++ b/src/components-examples/cdk/drag-drop/cdk-drag-drop-disabled-sorting/cdk-drag-drop-disabled-sorting-example.ts @@ -1,5 +1,4 @@ import {Component} from '@angular/core'; -import {NgFor} from '@angular/common'; import { CdkDrag, CdkDragDrop, @@ -17,7 +16,7 @@ import { templateUrl: 'cdk-drag-drop-disabled-sorting-example.html', styleUrls: ['cdk-drag-drop-disabled-sorting-example.css'], standalone: true, - imports: [CdkDropListGroup, CdkDropList, NgFor, CdkDrag], + imports: [CdkDropListGroup, CdkDropList, CdkDrag], }) export class CdkDragDropDisabledSortingExample { items = ['Carrots', 'Tomatoes', 'Onions', 'Apples', 'Avocados']; diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-disabled/cdk-drag-drop-disabled-example.html b/src/components-examples/cdk/drag-drop/cdk-drag-drop-disabled/cdk-drag-drop-disabled-example.html index d258da1b47de..75c0f30f1624 100644 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-disabled/cdk-drag-drop-disabled-example.html +++ b/src/components-examples/cdk/drag-drop/cdk-drag-drop-disabled/cdk-drag-drop-disabled-example.html @@ -1,7 +1,8 @@
    -
    {{item.value}}
    + @for (item of items; track item) { +
    {{item.value}}
    + }
    diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-disabled/cdk-drag-drop-disabled-example.ts b/src/components-examples/cdk/drag-drop/cdk-drag-drop-disabled/cdk-drag-drop-disabled-example.ts index 95512519c67e..a9bc78fe7921 100644 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-disabled/cdk-drag-drop-disabled-example.ts +++ b/src/components-examples/cdk/drag-drop/cdk-drag-drop-disabled/cdk-drag-drop-disabled-example.ts @@ -1,6 +1,5 @@ import {Component} from '@angular/core'; import {CdkDragDrop, CdkDrag, CdkDropList, moveItemInArray} from '@angular/cdk/drag-drop'; -import {NgFor} from '@angular/common'; /** * @title Drag&Drop disabled @@ -10,7 +9,7 @@ import {NgFor} from '@angular/common'; templateUrl: 'cdk-drag-drop-disabled-example.html', styleUrls: ['cdk-drag-drop-disabled-example.css'], standalone: true, - imports: [CdkDropList, NgFor, CdkDrag], + imports: [CdkDropList, CdkDrag], }) export class CdkDragDropDisabledExample { items = [ diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-enter-predicate/cdk-drag-drop-enter-predicate-example.html b/src/components-examples/cdk/drag-drop/cdk-drag-drop-enter-predicate/cdk-drag-drop-enter-predicate-example.html index d8d02e342bb9..258fb3c5d8ce 100644 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-enter-predicate/cdk-drag-drop-enter-predicate-example.html +++ b/src/components-examples/cdk/drag-drop/cdk-drag-drop-enter-predicate/cdk-drag-drop-enter-predicate-example.html @@ -9,11 +9,12 @@

    Available numbers

    class="example-list" (cdkDropListDropped)="drop($event)" [cdkDropListEnterPredicate]="noReturnPredicate"> -
    {{number}}
    + @for (number of all; track number) { +
    {{number}}
    + } @@ -28,11 +29,12 @@

    Even numbers

    class="example-list" (cdkDropListDropped)="drop($event)" [cdkDropListEnterPredicate]="evenPredicate"> -
    {{number}}
    + @for (number of even; track number) { +
    {{number}}
    + } diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-enter-predicate/cdk-drag-drop-enter-predicate-example.ts b/src/components-examples/cdk/drag-drop/cdk-drag-drop-enter-predicate/cdk-drag-drop-enter-predicate-example.ts index 0f761795970a..2db8c906b9a2 100644 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-enter-predicate/cdk-drag-drop-enter-predicate-example.ts +++ b/src/components-examples/cdk/drag-drop/cdk-drag-drop-enter-predicate/cdk-drag-drop-enter-predicate-example.ts @@ -1,5 +1,4 @@ import {Component} from '@angular/core'; -import {NgFor} from '@angular/common'; import { CdkDragDrop, moveItemInArray, @@ -16,7 +15,7 @@ import { templateUrl: 'cdk-drag-drop-enter-predicate-example.html', styleUrls: ['cdk-drag-drop-enter-predicate-example.css'], standalone: true, - imports: [CdkDropList, NgFor, CdkDrag], + imports: [CdkDropList, CdkDrag], }) export class CdkDragDropEnterPredicateExample { all = [1, 2, 3, 4, 5, 6, 7, 8, 9]; diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-horizontal-sorting/cdk-drag-drop-horizontal-sorting-example.html b/src/components-examples/cdk/drag-drop/cdk-drag-drop-horizontal-sorting/cdk-drag-drop-horizontal-sorting-example.html index d32505ba1a15..f476de2fa1a2 100644 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-horizontal-sorting/cdk-drag-drop-horizontal-sorting-example.html +++ b/src/components-examples/cdk/drag-drop/cdk-drag-drop-horizontal-sorting/cdk-drag-drop-horizontal-sorting-example.html @@ -1,3 +1,5 @@
    -
    {{timePeriod}}
    + @for (timePeriod of timePeriods; track timePeriod) { +
    {{timePeriod}}
    + }
    diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-horizontal-sorting/cdk-drag-drop-horizontal-sorting-example.ts b/src/components-examples/cdk/drag-drop/cdk-drag-drop-horizontal-sorting/cdk-drag-drop-horizontal-sorting-example.ts index 3eb91457a54d..2b6193cba1bf 100644 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-horizontal-sorting/cdk-drag-drop-horizontal-sorting-example.ts +++ b/src/components-examples/cdk/drag-drop/cdk-drag-drop-horizontal-sorting/cdk-drag-drop-horizontal-sorting-example.ts @@ -1,5 +1,4 @@ import {Component} from '@angular/core'; -import {NgFor} from '@angular/common'; import {CdkDragDrop, CdkDrag, CdkDropList, moveItemInArray} from '@angular/cdk/drag-drop'; /** @@ -10,7 +9,7 @@ import {CdkDragDrop, CdkDrag, CdkDropList, moveItemInArray} from '@angular/cdk/d templateUrl: 'cdk-drag-drop-horizontal-sorting-example.html', styleUrls: ['cdk-drag-drop-horizontal-sorting-example.css'], standalone: true, - imports: [CdkDropList, NgFor, CdkDrag], + imports: [CdkDropList, CdkDrag], }) export class CdkDragDropHorizontalSortingExample { timePeriods = [ diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-sort-predicate/cdk-drag-drop-sort-predicate-example.html b/src/components-examples/cdk/drag-drop/cdk-drag-drop-sort-predicate/cdk-drag-drop-sort-predicate-example.html index 34c2d6711dc7..1e97c0c37e49 100644 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-sort-predicate/cdk-drag-drop-sort-predicate-example.html +++ b/src/components-examples/cdk/drag-drop/cdk-drag-drop-sort-predicate/cdk-drag-drop-sort-predicate-example.html @@ -3,9 +3,10 @@ class="example-list" (cdkDropListDropped)="drop($event)" [cdkDropListSortPredicate]="sortPredicate"> -
    {{number}}
    + @for (number of numbers; track number) { +
    {{number}}
    + } diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-sort-predicate/cdk-drag-drop-sort-predicate-example.ts b/src/components-examples/cdk/drag-drop/cdk-drag-drop-sort-predicate/cdk-drag-drop-sort-predicate-example.ts index 8fa2a25d9692..86f8f2a8edd0 100644 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-sort-predicate/cdk-drag-drop-sort-predicate-example.ts +++ b/src/components-examples/cdk/drag-drop/cdk-drag-drop-sort-predicate/cdk-drag-drop-sort-predicate-example.ts @@ -1,5 +1,4 @@ import {Component} from '@angular/core'; -import {NgFor} from '@angular/common'; import {CdkDragDrop, moveItemInArray, CdkDrag, CdkDropList} from '@angular/cdk/drag-drop'; /** @@ -10,7 +9,7 @@ import {CdkDragDrop, moveItemInArray, CdkDrag, CdkDropList} from '@angular/cdk/d templateUrl: 'cdk-drag-drop-sort-predicate-example.html', styleUrls: ['cdk-drag-drop-sort-predicate-example.css'], standalone: true, - imports: [CdkDropList, NgFor, CdkDrag], + imports: [CdkDropList, CdkDrag], }) export class CdkDragDropSortPredicateExample { numbers = [1, 2, 3, 4, 5, 6, 7, 8]; diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-sorting/cdk-drag-drop-sorting-example.html b/src/components-examples/cdk/drag-drop/cdk-drag-drop-sorting/cdk-drag-drop-sorting-example.html index 699c95cf9c7b..d240babbfc3d 100644 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-sorting/cdk-drag-drop-sorting-example.html +++ b/src/components-examples/cdk/drag-drop/cdk-drag-drop-sorting/cdk-drag-drop-sorting-example.html @@ -1,3 +1,5 @@
    -
    {{movie}}
    + @for (movie of movies; track movie) { +
    {{movie}}
    + }
    diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-sorting/cdk-drag-drop-sorting-example.ts b/src/components-examples/cdk/drag-drop/cdk-drag-drop-sorting/cdk-drag-drop-sorting-example.ts index 35a8e31a51d7..5674fc049ad4 100644 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-sorting/cdk-drag-drop-sorting-example.ts +++ b/src/components-examples/cdk/drag-drop/cdk-drag-drop-sorting/cdk-drag-drop-sorting-example.ts @@ -1,6 +1,5 @@ import {Component} from '@angular/core'; import {CdkDragDrop, CdkDropList, CdkDrag, moveItemInArray} from '@angular/cdk/drag-drop'; -import {NgFor} from '@angular/common'; /** * @title Drag&Drop sorting @@ -10,7 +9,7 @@ import {NgFor} from '@angular/common'; templateUrl: 'cdk-drag-drop-sorting-example.html', styleUrls: ['cdk-drag-drop-sorting-example.css'], standalone: true, - imports: [CdkDropList, NgFor, CdkDrag], + imports: [CdkDropList, CdkDrag], }) export class CdkDragDropSortingExample { movies = [ diff --git a/src/components-examples/cdk/listbox/cdk-listbox-activedescendant/cdk-listbox-activedescendant-example.html b/src/components-examples/cdk/listbox/cdk-listbox-activedescendant/cdk-listbox-activedescendant-example.html index 26cd1eba7ed9..1cecc7c5f695 100644 --- a/src/components-examples/cdk/listbox/cdk-listbox-activedescendant/cdk-listbox-activedescendant-example.html +++ b/src/components-examples/cdk/listbox/cdk-listbox-activedescendant/cdk-listbox-activedescendant-example.html @@ -8,11 +8,9 @@ cdkListboxUseActiveDescendant aria-labelledby="example-spatula-label" class="example-listbox"> -
  • - {{feature}} -
  • + @for (feature of features; track feature) { +
  • {{feature}}
  • + } diff --git a/src/components-examples/cdk/listbox/cdk-listbox-activedescendant/cdk-listbox-activedescendant-example.ts b/src/components-examples/cdk/listbox/cdk-listbox-activedescendant/cdk-listbox-activedescendant-example.ts index 5d1c5f36c88b..5e979318bc79 100644 --- a/src/components-examples/cdk/listbox/cdk-listbox-activedescendant/cdk-listbox-activedescendant-example.ts +++ b/src/components-examples/cdk/listbox/cdk-listbox-activedescendant/cdk-listbox-activedescendant-example.ts @@ -1,5 +1,4 @@ import {Component} from '@angular/core'; -import {NgFor} from '@angular/common'; import {CdkListbox, CdkOption} from '@angular/cdk/listbox'; /** @title Listbox with aria-activedescendant. */ @@ -9,7 +8,7 @@ import {CdkListbox, CdkOption} from '@angular/cdk/listbox'; templateUrl: 'cdk-listbox-activedescendant-example.html', styleUrls: ['cdk-listbox-activedescendant-example.css'], standalone: true, - imports: [CdkListbox, NgFor, CdkOption], + imports: [CdkListbox, CdkOption], }) export class CdkListboxActivedescendantExample { features = ['Hydrodynamic', 'Port & Starboard Attachments', 'Turbo Drive']; diff --git a/src/components-examples/cdk/listbox/cdk-listbox-compare-with/cdk-listbox-compare-with-example.html b/src/components-examples/cdk/listbox/cdk-listbox-compare-with/cdk-listbox-compare-with-example.html index 088bf43edab2..471dceff9461 100644 --- a/src/components-examples/cdk/listbox/cdk-listbox-compare-with/cdk-listbox-compare-with-example.html +++ b/src/components-examples/cdk/listbox/cdk-listbox-compare-with/cdk-listbox-compare-with-example.html @@ -9,14 +9,14 @@ (cdkListboxValueChange)="appointment = $event.value" aria-labelledby="example-appointment-label" class="example-listbox"> -
  • - {{formatTime(time)}} -
  • + @for (time of slots; track time) { +
  • {{formatTime(time)}}
  • + } -

    - Your appointment is scheduled for {{formatAppointment() | json}}  -

    +@if (appointment[0]) { +

    + Your appointment is scheduled for {{formatAppointment() | json}}  +

    +} diff --git a/src/components-examples/cdk/listbox/cdk-listbox-compare-with/cdk-listbox-compare-with-example.ts b/src/components-examples/cdk/listbox/cdk-listbox-compare-with/cdk-listbox-compare-with-example.ts index 9a1e2103c828..fc79ef4ac178 100644 --- a/src/components-examples/cdk/listbox/cdk-listbox-compare-with/cdk-listbox-compare-with-example.ts +++ b/src/components-examples/cdk/listbox/cdk-listbox-compare-with/cdk-listbox-compare-with-example.ts @@ -1,5 +1,5 @@ import {Component} from '@angular/core'; -import {NgFor, NgIf, JsonPipe} from '@angular/common'; +import {JsonPipe} from '@angular/common'; import {CdkListbox, CdkOption} from '@angular/cdk/listbox'; const today = new Date(); @@ -19,7 +19,7 @@ const formatter = new Intl.DateTimeFormat(undefined, { templateUrl: 'cdk-listbox-compare-with-example.html', styleUrls: ['cdk-listbox-compare-with-example.css'], standalone: true, - imports: [CdkListbox, NgFor, CdkOption, NgIf, JsonPipe], + imports: [CdkListbox, CdkOption, JsonPipe], }) export class CdkListboxCompareWithExample { slots = [12, 13, 14, 15].map( diff --git a/src/components-examples/cdk/listbox/cdk-listbox-forms-validation/cdk-listbox-forms-validation-example.html b/src/components-examples/cdk/listbox/cdk-listbox-forms-validation/cdk-listbox-forms-validation-example.html index 5cc648351875..391e26f1a7b2 100644 --- a/src/components-examples/cdk/listbox/cdk-listbox-forms-validation/cdk-listbox-forms-validation-example.html +++ b/src/components-examples/cdk/listbox/cdk-listbox-forms-validation/cdk-listbox-forms-validation-example.html @@ -6,16 +6,18 @@ [formControl]="signCtrl" aria-labelledby="example-zodiac-sign-label" class="example-listbox"> -
  • - {{sign}} -
  • + @for (sign of signs; track sign) { +
  • {{sign}}
  • + } -
    -

    {{error}}

    -
    +@if (invalid | async) { +
    + @for (error of getErrors(); track error) { +

    {{error}}

    + } +
    +}

    Your zodiac sign is: {{signCtrl.value | json}}    diff --git a/src/components-examples/cdk/listbox/cdk-listbox-forms-validation/cdk-listbox-forms-validation-example.ts b/src/components-examples/cdk/listbox/cdk-listbox-forms-validation/cdk-listbox-forms-validation-example.ts index ff6e9c215d57..a8ca73893fb4 100644 --- a/src/components-examples/cdk/listbox/cdk-listbox-forms-validation/cdk-listbox-forms-validation-example.ts +++ b/src/components-examples/cdk/listbox/cdk-listbox-forms-validation/cdk-listbox-forms-validation-example.ts @@ -2,7 +2,7 @@ import {Component} from '@angular/core'; import {FormControl, Validators, FormsModule, ReactiveFormsModule} from '@angular/forms'; import {map} from 'rxjs/operators'; import {Observable} from 'rxjs'; -import {NgFor, NgIf, AsyncPipe, JsonPipe} from '@angular/common'; +import {AsyncPipe, JsonPipe} from '@angular/common'; import {CdkListbox, CdkOption} from '@angular/cdk/listbox'; /** @title Listbox with forms validation. */ @@ -12,16 +12,7 @@ import {CdkListbox, CdkOption} from '@angular/cdk/listbox'; templateUrl: 'cdk-listbox-forms-validation-example.html', styleUrls: ['cdk-listbox-forms-validation-example.css'], standalone: true, - imports: [ - CdkListbox, - FormsModule, - ReactiveFormsModule, - NgFor, - CdkOption, - NgIf, - AsyncPipe, - JsonPipe, - ], + imports: [CdkListbox, FormsModule, ReactiveFormsModule, CdkOption, AsyncPipe, JsonPipe], }) export class CdkListboxFormsValidationExample { signs = [ diff --git a/src/components-examples/cdk/listbox/cdk-listbox-horizontal/cdk-listbox-horizontal-example.html b/src/components-examples/cdk/listbox/cdk-listbox-horizontal/cdk-listbox-horizontal-example.html index 08b362fb333b..5b5e6f19b386 100644 --- a/src/components-examples/cdk/listbox/cdk-listbox-horizontal/cdk-listbox-horizontal-example.html +++ b/src/components-examples/cdk/listbox/cdk-listbox-horizontal/cdk-listbox-horizontal-example.html @@ -6,10 +6,8 @@ cdkListboxOrientation="horizontal" aria-labelledby="example-shirt-size-label" class="example-listbox"> -

  • - {{size}} -
  • + @for (size of sizes; track size) { +
  • {{size}}
  • + } diff --git a/src/components-examples/cdk/listbox/cdk-listbox-horizontal/cdk-listbox-horizontal-example.ts b/src/components-examples/cdk/listbox/cdk-listbox-horizontal/cdk-listbox-horizontal-example.ts index d77a424be855..efbdcabce378 100644 --- a/src/components-examples/cdk/listbox/cdk-listbox-horizontal/cdk-listbox-horizontal-example.ts +++ b/src/components-examples/cdk/listbox/cdk-listbox-horizontal/cdk-listbox-horizontal-example.ts @@ -1,5 +1,4 @@ import {Component} from '@angular/core'; -import {NgFor} from '@angular/common'; import {CdkListbox, CdkOption} from '@angular/cdk/listbox'; /** @title Horizontal listbox */ @@ -9,7 +8,7 @@ import {CdkListbox, CdkOption} from '@angular/cdk/listbox'; templateUrl: 'cdk-listbox-horizontal-example.html', styleUrls: ['cdk-listbox-horizontal-example.css'], standalone: true, - imports: [CdkListbox, NgFor, CdkOption], + imports: [CdkListbox, CdkOption], }) export class CdkListboxHorizontalExample { sizes = ['XS', 'S', 'M', 'L', 'XL']; diff --git a/src/components-examples/cdk/listbox/cdk-listbox-reactive-forms/cdk-listbox-reactive-forms-example.html b/src/components-examples/cdk/listbox/cdk-listbox-reactive-forms/cdk-listbox-reactive-forms-example.html index 49b8588c8ab7..5f102c98f005 100644 --- a/src/components-examples/cdk/listbox/cdk-listbox-reactive-forms/cdk-listbox-reactive-forms-example.html +++ b/src/components-examples/cdk/listbox/cdk-listbox-reactive-forms/cdk-listbox-reactive-forms-example.html @@ -7,11 +7,9 @@ [formControl]="languageCtrl" aria-labelledby="example-language-label" class="example-listbox"> -
  • - {{language}} -
  • + @for (language of languages; track language) { +
  • {{language}}
  • + } diff --git a/src/components-examples/cdk/listbox/cdk-listbox-reactive-forms/cdk-listbox-reactive-forms-example.ts b/src/components-examples/cdk/listbox/cdk-listbox-reactive-forms/cdk-listbox-reactive-forms-example.ts index cd39f4c44278..ffa5a9b8d58a 100644 --- a/src/components-examples/cdk/listbox/cdk-listbox-reactive-forms/cdk-listbox-reactive-forms-example.ts +++ b/src/components-examples/cdk/listbox/cdk-listbox-reactive-forms/cdk-listbox-reactive-forms-example.ts @@ -1,6 +1,6 @@ import {Component} from '@angular/core'; import {FormControl, FormsModule, ReactiveFormsModule} from '@angular/forms'; -import {NgFor, JsonPipe} from '@angular/common'; +import {JsonPipe} from '@angular/common'; import {CdkListbox, CdkOption} from '@angular/cdk/listbox'; /** @title Listbox with reactive forms. */ @@ -10,7 +10,7 @@ import {CdkListbox, CdkOption} from '@angular/cdk/listbox'; templateUrl: 'cdk-listbox-reactive-forms-example.html', styleUrls: ['cdk-listbox-reactive-forms-example.css'], standalone: true, - imports: [CdkListbox, FormsModule, ReactiveFormsModule, NgFor, CdkOption, JsonPipe], + imports: [CdkListbox, FormsModule, ReactiveFormsModule, CdkOption, JsonPipe], }) export class CdkListboxReactiveFormsExample { languages = ['C++', 'Java', 'JavaScript', 'Python', 'TypeScript']; diff --git a/src/components-examples/cdk/listbox/cdk-listbox-template-forms/cdk-listbox-template-forms-example.html b/src/components-examples/cdk/listbox/cdk-listbox-template-forms/cdk-listbox-template-forms-example.html index be65ce12ef62..a342812b74a7 100644 --- a/src/components-examples/cdk/listbox/cdk-listbox-template-forms/cdk-listbox-template-forms-example.html +++ b/src/components-examples/cdk/listbox/cdk-listbox-template-forms/cdk-listbox-template-forms-example.html @@ -8,11 +8,9 @@ [(ngModel)]="order" aria-labelledby="example-toppings-label" class="example-listbox"> -
  • - {{topping}} -
  • + @for (topping of toppings; track topping) { +
  • {{topping}}
  • + } diff --git a/src/components-examples/cdk/listbox/cdk-listbox-template-forms/cdk-listbox-template-forms-example.ts b/src/components-examples/cdk/listbox/cdk-listbox-template-forms/cdk-listbox-template-forms-example.ts index 3d429e15272c..d563594683a2 100644 --- a/src/components-examples/cdk/listbox/cdk-listbox-template-forms/cdk-listbox-template-forms-example.ts +++ b/src/components-examples/cdk/listbox/cdk-listbox-template-forms/cdk-listbox-template-forms-example.ts @@ -1,5 +1,5 @@ import {Component} from '@angular/core'; -import {NgFor, JsonPipe} from '@angular/common'; +import {JsonPipe} from '@angular/common'; import {FormsModule} from '@angular/forms'; import {CdkListbox, CdkOption} from '@angular/cdk/listbox'; @@ -10,7 +10,7 @@ import {CdkListbox, CdkOption} from '@angular/cdk/listbox'; templateUrl: 'cdk-listbox-template-forms-example.html', styleUrls: ['cdk-listbox-template-forms-example.css'], standalone: true, - imports: [CdkListbox, FormsModule, NgFor, CdkOption, JsonPipe], + imports: [CdkListbox, FormsModule, CdkOption, JsonPipe], }) export class CdkListboxTemplateFormsExample { toppings = ['Extra Cheese', 'Mushrooms', 'Pepperoni', 'Sausage']; diff --git a/src/components-examples/cdk/listbox/cdk-listbox-value-binding/cdk-listbox-value-binding-example.html b/src/components-examples/cdk/listbox/cdk-listbox-value-binding/cdk-listbox-value-binding-example.html index a5ecd604914b..ecc594508f71 100644 --- a/src/components-examples/cdk/listbox/cdk-listbox-value-binding/cdk-listbox-value-binding-example.html +++ b/src/components-examples/cdk/listbox/cdk-listbox-value-binding/cdk-listbox-value-binding-example.html @@ -8,11 +8,9 @@ (cdkListboxValueChange)="starter = $event.value" aria-labelledby="example-starter-pokemon-label" class="example-listbox"> -
  • - {{pokemon}} -
  • + @for (pokemon of starters; track pokemon) { +
  • {{pokemon}}
  • + } diff --git a/src/components-examples/cdk/listbox/cdk-listbox-value-binding/cdk-listbox-value-binding-example.ts b/src/components-examples/cdk/listbox/cdk-listbox-value-binding/cdk-listbox-value-binding-example.ts index 3cc0140cf403..df90e254246e 100644 --- a/src/components-examples/cdk/listbox/cdk-listbox-value-binding/cdk-listbox-value-binding-example.ts +++ b/src/components-examples/cdk/listbox/cdk-listbox-value-binding/cdk-listbox-value-binding-example.ts @@ -1,5 +1,5 @@ import {Component} from '@angular/core'; -import {NgFor, JsonPipe} from '@angular/common'; +import {JsonPipe} from '@angular/common'; import {CdkListbox, CdkOption} from '@angular/cdk/listbox'; /** @title Listbox with value binding. */ @@ -9,7 +9,7 @@ import {CdkListbox, CdkOption} from '@angular/cdk/listbox'; templateUrl: 'cdk-listbox-value-binding-example.html', styleUrls: ['cdk-listbox-value-binding-example.css'], standalone: true, - imports: [CdkListbox, NgFor, CdkOption, JsonPipe], + imports: [CdkListbox, CdkOption, JsonPipe], }) export class CdkListboxValueBindingExample { starters = ['Sprigatito', 'Fuecoco', 'Quaxly']; diff --git a/src/components-examples/cdk/menu/cdk-menu-standalone-stateful-menu/cdk-menu-standalone-stateful-menu-example.html b/src/components-examples/cdk/menu/cdk-menu-standalone-stateful-menu/cdk-menu-standalone-stateful-menu-example.html index b553bf7a6c1b..5941d6fdf55e 100644 --- a/src/components-examples/cdk/menu/cdk-menu-standalone-stateful-menu/cdk-menu-standalone-stateful-menu-example.html +++ b/src/components-examples/cdk/menu/cdk-menu-standalone-stateful-menu/cdk-menu-standalone-stateful-menu-example.html @@ -21,14 +21,15 @@
    - + @for (size of sizes; track size) { + + }

    diff --git a/src/components-examples/cdk/menu/cdk-menu-standalone-stateful-menu/cdk-menu-standalone-stateful-menu-example.ts b/src/components-examples/cdk/menu/cdk-menu-standalone-stateful-menu/cdk-menu-standalone-stateful-menu-example.ts index e68e5a7baec7..c9ae902bffa7 100644 --- a/src/components-examples/cdk/menu/cdk-menu-standalone-stateful-menu/cdk-menu-standalone-stateful-menu-example.ts +++ b/src/components-examples/cdk/menu/cdk-menu-standalone-stateful-menu/cdk-menu-standalone-stateful-menu-example.ts @@ -1,5 +1,4 @@ import {Component} from '@angular/core'; -import {NgFor} from '@angular/common'; import { CdkMenu, CdkMenuItem, @@ -20,7 +19,6 @@ import { CdkMenu, CdkMenuItemCheckbox, CdkMenuGroup, - NgFor, CdkMenuItemRadio, CdkMenuItem, ], diff --git a/src/components-examples/cdk/scrolling/cdk-virtual-scroll-window-scrolling/cdk-virtual-scroll-window-scrolling-example.html b/src/components-examples/cdk/scrolling/cdk-virtual-scroll-window-scrolling/cdk-virtual-scroll-window-scrolling-example.html index 0020c02846a5..016b70b3c70d 100644 --- a/src/components-examples/cdk/scrolling/cdk-virtual-scroll-window-scrolling/cdk-virtual-scroll-window-scrolling-example.html +++ b/src/components-examples/cdk/scrolling/cdk-virtual-scroll-window-scrolling/cdk-virtual-scroll-window-scrolling-example.html @@ -1,9 +1,11 @@ - +@if (shouldRun) {
    Content before
    {{item}}
    -
    +} -
    Please open on StackBlitz to see result
    +@if (!shouldRun) { +
    Please open on StackBlitz to see result
    +} diff --git a/src/components-examples/cdk/scrolling/cdk-virtual-scroll-window-scrolling/cdk-virtual-scroll-window-scrolling-example.ts b/src/components-examples/cdk/scrolling/cdk-virtual-scroll-window-scrolling/cdk-virtual-scroll-window-scrolling-example.ts index 85ea301d4074..8b8de163953a 100644 --- a/src/components-examples/cdk/scrolling/cdk-virtual-scroll-window-scrolling/cdk-virtual-scroll-window-scrolling-example.ts +++ b/src/components-examples/cdk/scrolling/cdk-virtual-scroll-window-scrolling/cdk-virtual-scroll-window-scrolling-example.ts @@ -1,5 +1,4 @@ import {ChangeDetectionStrategy, Component, Input} from '@angular/core'; -import {NgIf} from '@angular/common'; import {ScrollingModule} from '@angular/cdk/scrolling'; /** @title Virtual scrolling window */ @@ -9,7 +8,7 @@ import {ScrollingModule} from '@angular/cdk/scrolling'; templateUrl: 'cdk-virtual-scroll-window-scrolling-example.html', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, - imports: [NgIf, ScrollingModule], + imports: [ScrollingModule], }) export class CdkVirtualScrollWindowScrollingExample { @Input() shouldRun = /(^|.)(stackblitz|webcontainer).(io|com)$/.test(window.location.host); diff --git a/src/components-examples/cdk/stepper/cdk-custom-stepper-without-form/cdk-custom-stepper-without-form-example.ts b/src/components-examples/cdk/stepper/cdk-custom-stepper-without-form/cdk-custom-stepper-without-form-example.ts index d21e092b0381..19d1fb595847 100644 --- a/src/components-examples/cdk/stepper/cdk-custom-stepper-without-form/cdk-custom-stepper-without-form-example.ts +++ b/src/components-examples/cdk/stepper/cdk-custom-stepper-without-form/cdk-custom-stepper-without-form-example.ts @@ -1,6 +1,6 @@ import {Component, forwardRef} from '@angular/core'; import {CdkStepper, CdkStepperModule} from '@angular/cdk/stepper'; -import {NgTemplateOutlet, NgFor} from '@angular/common'; +import {NgTemplateOutlet} from '@angular/common'; /** @title A custom CDK stepper without a form */ @Component({ @@ -19,7 +19,7 @@ export class CdkCustomStepperWithoutFormExample {} styleUrls: ['./example-custom-stepper.css'], providers: [{provide: CdkStepper, useExisting: CustomStepper}], standalone: true, - imports: [NgTemplateOutlet, CdkStepperModule, NgFor], + imports: [NgTemplateOutlet, CdkStepperModule], }) export class CustomStepper extends CdkStepper { selectStepByIndex(index: number): void { diff --git a/src/components-examples/cdk/stepper/cdk-custom-stepper-without-form/example-custom-stepper.html b/src/components-examples/cdk/stepper/cdk-custom-stepper-without-form/example-custom-stepper.html index f3cb23972f5d..625c72b8bf92 100644 --- a/src/components-examples/cdk/stepper/cdk-custom-stepper-without-form/example-custom-stepper.html +++ b/src/components-examples/cdk/stepper/cdk-custom-stepper-without-form/example-custom-stepper.html @@ -7,14 +7,12 @@

    Step {{ selectedIndex + 1 }}/{{ steps.length }}

    - + @for (step of steps; track step; let i = $index) { + + }
    diff --git a/src/components-examples/cdk/stepper/cdk-linear-stepper-with-form/cdk-linear-stepper-with-form-example.ts b/src/components-examples/cdk/stepper/cdk-linear-stepper-with-form/cdk-linear-stepper-with-form-example.ts index 6b422e4a414a..16a8f9a20d04 100644 --- a/src/components-examples/cdk/stepper/cdk-linear-stepper-with-form/cdk-linear-stepper-with-form-example.ts +++ b/src/components-examples/cdk/stepper/cdk-linear-stepper-with-form/cdk-linear-stepper-with-form-example.ts @@ -1,7 +1,7 @@ import {Component, forwardRef} from '@angular/core'; import {CdkStepper, CdkStepperModule} from '@angular/cdk/stepper'; import {FormBuilder, Validators, FormsModule, ReactiveFormsModule} from '@angular/forms'; -import {NgTemplateOutlet, NgFor} from '@angular/common'; +import {NgTemplateOutlet} from '@angular/common'; /** @title A custom CDK linear stepper with forms */ @Component({ @@ -39,7 +39,7 @@ export class CdkLinearStepperWithFormExample { styleUrls: ['./example-custom-linear-stepper.css'], providers: [{provide: CdkStepper, useExisting: CustomLinearStepper}], standalone: true, - imports: [NgTemplateOutlet, CdkStepperModule, NgFor], + imports: [NgTemplateOutlet, CdkStepperModule], }) export class CustomLinearStepper extends CdkStepper { selectStepByIndex(index: number): void { diff --git a/src/components-examples/cdk/stepper/cdk-linear-stepper-with-form/example-custom-linear-stepper.html b/src/components-examples/cdk/stepper/cdk-linear-stepper-with-form/example-custom-linear-stepper.html index ec97b13bf0f4..70bc88308cc0 100644 --- a/src/components-examples/cdk/stepper/cdk-linear-stepper-with-form/example-custom-linear-stepper.html +++ b/src/components-examples/cdk/stepper/cdk-linear-stepper-with-form/example-custom-linear-stepper.html @@ -7,14 +7,12 @@

    Step {{selectedIndex + 1}}/{{steps.length}}

    - + @for (step of steps; track step; let i = $index) { + + }
    diff --git a/src/components-examples/cdk/text-field/text-field-autofill-directive/text-field-autofill-directive-example.html b/src/components-examples/cdk/text-field/text-field-autofill-directive/text-field-autofill-directive-example.html index 9942f27a0852..1d2b160fe1ff 100644 --- a/src/components-examples/cdk/text-field/text-field-autofill-directive/text-field-autofill-directive-example.html +++ b/src/components-examples/cdk/text-field/text-field-autofill-directive/text-field-autofill-directive-example.html @@ -2,12 +2,16 @@ First name - Autofilled! + @if (firstNameAutofilled) { + Autofilled! + } Last name - Autofilled! + @if (lastNameAutofilled) { + Autofilled! + } diff --git a/src/components-examples/cdk/text-field/text-field-autofill-directive/text-field-autofill-directive-example.ts b/src/components-examples/cdk/text-field/text-field-autofill-directive/text-field-autofill-directive-example.ts index 73e0fc67cc51..2762b18a9a00 100644 --- a/src/components-examples/cdk/text-field/text-field-autofill-directive/text-field-autofill-directive-example.ts +++ b/src/components-examples/cdk/text-field/text-field-autofill-directive/text-field-autofill-directive-example.ts @@ -1,6 +1,5 @@ import {Component} from '@angular/core'; import {MatButtonModule} from '@angular/material/button'; -import {NgIf} from '@angular/common'; import {TextFieldModule} from '@angular/cdk/text-field'; import {MatInputModule} from '@angular/material/input'; import {MatFormFieldModule} from '@angular/material/form-field'; @@ -11,7 +10,7 @@ import {MatFormFieldModule} from '@angular/material/form-field'; templateUrl: './text-field-autofill-directive-example.html', styleUrls: ['./text-field-autofill-directive-example.css'], standalone: true, - imports: [MatFormFieldModule, MatInputModule, TextFieldModule, NgIf, MatButtonModule], + imports: [MatFormFieldModule, MatInputModule, TextFieldModule, MatButtonModule], }) export class TextFieldAutofillDirectiveExample { firstNameAutofilled: boolean; diff --git a/src/components-examples/cdk/text-field/text-field-autofill-monitor/text-field-autofill-monitor-example.html b/src/components-examples/cdk/text-field/text-field-autofill-monitor/text-field-autofill-monitor-example.html index e9ae5d687871..22087273e8cd 100644 --- a/src/components-examples/cdk/text-field/text-field-autofill-monitor/text-field-autofill-monitor-example.html +++ b/src/components-examples/cdk/text-field/text-field-autofill-monitor/text-field-autofill-monitor-example.html @@ -2,12 +2,16 @@ First name - Autofilled! + @if (firstNameAutofilled) { + Autofilled! + } Last name - Autofilled! + @if (lastNameAutofilled) { + Autofilled! + } diff --git a/src/components-examples/cdk/text-field/text-field-autofill-monitor/text-field-autofill-monitor-example.ts b/src/components-examples/cdk/text-field/text-field-autofill-monitor/text-field-autofill-monitor-example.ts index 880a0882e534..61026ad8baaa 100644 --- a/src/components-examples/cdk/text-field/text-field-autofill-monitor/text-field-autofill-monitor-example.ts +++ b/src/components-examples/cdk/text-field/text-field-autofill-monitor/text-field-autofill-monitor-example.ts @@ -1,7 +1,6 @@ import {AutofillMonitor} from '@angular/cdk/text-field'; import {AfterViewInit, Component, ElementRef, OnDestroy, ViewChild} from '@angular/core'; import {MatButtonModule} from '@angular/material/button'; -import {NgIf} from '@angular/common'; import {MatInputModule} from '@angular/material/input'; import {MatFormFieldModule} from '@angular/material/form-field'; @@ -11,7 +10,7 @@ import {MatFormFieldModule} from '@angular/material/form-field'; templateUrl: './text-field-autofill-monitor-example.html', styleUrls: ['./text-field-autofill-monitor-example.css'], standalone: true, - imports: [MatFormFieldModule, MatInputModule, NgIf, MatButtonModule], + imports: [MatFormFieldModule, MatInputModule, MatButtonModule], }) export class TextFieldAutofillMonitorExample implements AfterViewInit, OnDestroy { @ViewChild('first', {read: ElementRef}) firstName: ElementRef; diff --git a/src/components-examples/material-experimental/popover-edit/popover-edit-mat-table/popover-edit-mat-table-example.html b/src/components-examples/material-experimental/popover-edit/popover-edit-mat-table/popover-edit-mat-table-example.html index 4a4c076025bd..414532d5a1c7 100644 --- a/src/components-examples/material-experimental/popover-edit/popover-edit-mat-table/popover-edit-mat-table-example.html +++ b/src/components-examples/material-experimental/popover-edit/popover-edit-mat-table/popover-edit-mat-table-example.html @@ -70,11 +70,11 @@

    Name

    - + @if (nameEditEnabled) { - + } @@ -99,10 +99,9 @@

    Name

    [ngModel]="[element.type]" (selectionChange)="f.ngSubmit.emit()" aria-label="Element type"> - - {{type}} - + @for (type of TYPES; track type) { + {{type}} + } @@ -155,11 +154,11 @@

    Name

    - - {{fantasyElement}} - + checkboxPosition="before">{{fantasyElement}} + }
    diff --git a/src/components-examples/material-experimental/popover-edit/popover-edit-mat-table/popover-edit-mat-table-example.ts b/src/components-examples/material-experimental/popover-edit/popover-edit-mat-table/popover-edit-mat-table-example.ts index a3aaafd0b58e..1e051a32a336 100644 --- a/src/components-examples/material-experimental/popover-edit/popover-edit-mat-table/popover-edit-mat-table-example.ts +++ b/src/components-examples/material-experimental/popover-edit/popover-edit-mat-table/popover-edit-mat-table-example.ts @@ -5,7 +5,6 @@ import {NgForm, FormsModule} from '@angular/forms'; import {MatSnackBar, MatSnackBarModule} from '@angular/material/snack-bar'; import {BehaviorSubject, Observable} from 'rxjs'; import {MatListModule} from '@angular/material/list'; -import {NgIf, NgFor} from '@angular/common'; import {MatCheckboxModule} from '@angular/material/checkbox'; import {MatIconModule} from '@angular/material/icon'; import {MatButtonModule} from '@angular/material/button'; @@ -218,9 +217,7 @@ const FANTASY_ELEMENTS: readonly FantasyElement[] = [ MatButtonModule, MatIconModule, MatCheckboxModule, - NgIf, MatListModule, - NgFor, MatSnackBarModule, ], }) diff --git a/src/components-examples/material-experimental/selection/mat-selection-list/mat-selection-list-example.html b/src/components-examples/material-experimental/selection/mat-selection-list/mat-selection-list-example.html index bec0b35b1cc5..5c7a9b02ea85 100644 --- a/src/components-examples/material-experimental/selection/mat-selection-list/mat-selection-list-example.html +++ b/src/components-examples/material-experimental/selection/mat-selection-list/mat-selection-list-example.html @@ -5,40 +5,48 @@

    native input

    [checked]="allToggler.checked | async" [indeterminate]="allToggler.indeterminate | async" (click)="allToggler.toggle($event)"> -
  • - - {{item}} -
  • + @for (item of data; track item) { +
  • + + {{item}} +
  • + }

    mat-checkbox

    Selected: {{selected2}}
      -
    • + @for (item of data; track item) { +
    • {{item}}
    • +}

    Single select with mat-checkbox

    Selected: {{selected3}}
      -
    • - - {{item}} -
    • + @for (item of data; track item) { +
    • + + {{item}} +
    • + }

    with trackBy

    Selected: {{selected4}}
      -
    • - - {{item}} -
    • + @for (item of data; track trackByFn(i, item); let i = $index) { +
    • + + {{item}} +
    • + }
    diff --git a/src/components-examples/material-experimental/selection/mat-selection-list/mat-selection-list-example.ts b/src/components-examples/material-experimental/selection/mat-selection-list/mat-selection-list-example.ts index 96c43c5bf9d0..94e9eedb7a3a 100644 --- a/src/components-examples/material-experimental/selection/mat-selection-list/mat-selection-list-example.ts +++ b/src/components-examples/material-experimental/selection/mat-selection-list/mat-selection-list-example.ts @@ -1,7 +1,7 @@ import {SelectionChange} from '@angular/cdk-experimental/selection'; import {Component} from '@angular/core'; import {MatCheckboxModule} from '@angular/material/checkbox'; -import {NgFor, AsyncPipe} from '@angular/common'; +import {AsyncPipe} from '@angular/common'; import {MatSelectionModule} from '@angular/material-experimental/selection'; /** @@ -11,7 +11,7 @@ import {MatSelectionModule} from '@angular/material-experimental/selection'; selector: 'mat-selection-list-example', templateUrl: 'mat-selection-list-example.html', standalone: true, - imports: [MatSelectionModule, NgFor, MatCheckboxModule, AsyncPipe], + imports: [MatSelectionModule, MatCheckboxModule, AsyncPipe], }) export class MatSelectionListExample { data = ELEMENT_NAMES; diff --git a/src/components-examples/material/autocomplete/autocomplete-auto-active-first-option/autocomplete-auto-active-first-option-example.html b/src/components-examples/material/autocomplete/autocomplete-auto-active-first-option/autocomplete-auto-active-first-option-example.html index cfa15480831c..e1abe1ad5a4c 100644 --- a/src/components-examples/material/autocomplete/autocomplete-auto-active-first-option/autocomplete-auto-active-first-option-example.html +++ b/src/components-examples/material/autocomplete/autocomplete-auto-active-first-option/autocomplete-auto-active-first-option-example.html @@ -8,9 +8,9 @@ [formControl]="myControl" [matAutocomplete]="auto"> - - {{option}} - + @for (option of filteredOptions | async; track option) { + {{option}} + } diff --git a/src/components-examples/material/autocomplete/autocomplete-auto-active-first-option/autocomplete-auto-active-first-option-example.ts b/src/components-examples/material/autocomplete/autocomplete-auto-active-first-option/autocomplete-auto-active-first-option-example.ts index a8093b37e76f..8f18898d8903 100644 --- a/src/components-examples/material/autocomplete/autocomplete-auto-active-first-option/autocomplete-auto-active-first-option-example.ts +++ b/src/components-examples/material/autocomplete/autocomplete-auto-active-first-option/autocomplete-auto-active-first-option-example.ts @@ -2,7 +2,7 @@ import {Component, OnInit} from '@angular/core'; import {FormControl, FormsModule, ReactiveFormsModule} from '@angular/forms'; import {Observable} from 'rxjs'; import {map, startWith} from 'rxjs/operators'; -import {NgFor, AsyncPipe} from '@angular/common'; +import {AsyncPipe} from '@angular/common'; import {MatAutocompleteModule} from '@angular/material/autocomplete'; import {MatInputModule} from '@angular/material/input'; import {MatFormFieldModule} from '@angular/material/form-field'; @@ -21,7 +21,6 @@ import {MatFormFieldModule} from '@angular/material/form-field'; MatInputModule, MatAutocompleteModule, ReactiveFormsModule, - NgFor, AsyncPipe, ], }) diff --git a/src/components-examples/material/autocomplete/autocomplete-display/autocomplete-display-example.html b/src/components-examples/material/autocomplete/autocomplete-display/autocomplete-display-example.html index 455d42ef963b..479304681f7a 100644 --- a/src/components-examples/material/autocomplete/autocomplete-display/autocomplete-display-example.html +++ b/src/components-examples/material/autocomplete/autocomplete-display/autocomplete-display-example.html @@ -3,9 +3,9 @@ Assignee - - {{option.name}} - + @for (option of filteredOptions | async; track option) { + {{option.name}} + } diff --git a/src/components-examples/material/autocomplete/autocomplete-display/autocomplete-display-example.ts b/src/components-examples/material/autocomplete/autocomplete-display/autocomplete-display-example.ts index 5fc1a62c84fe..40394477d82e 100644 --- a/src/components-examples/material/autocomplete/autocomplete-display/autocomplete-display-example.ts +++ b/src/components-examples/material/autocomplete/autocomplete-display/autocomplete-display-example.ts @@ -2,7 +2,7 @@ import {Component, OnInit} from '@angular/core'; import {FormControl, FormsModule, ReactiveFormsModule} from '@angular/forms'; import {Observable} from 'rxjs'; import {map, startWith} from 'rxjs/operators'; -import {NgFor, AsyncPipe} from '@angular/common'; +import {AsyncPipe} from '@angular/common'; import {MatAutocompleteModule} from '@angular/material/autocomplete'; import {MatInputModule} from '@angular/material/input'; import {MatFormFieldModule} from '@angular/material/form-field'; @@ -25,7 +25,6 @@ export interface User { MatInputModule, MatAutocompleteModule, ReactiveFormsModule, - NgFor, AsyncPipe, ], }) diff --git a/src/components-examples/material/autocomplete/autocomplete-filter/autocomplete-filter-example.html b/src/components-examples/material/autocomplete/autocomplete-filter/autocomplete-filter-example.html index 1562b3c8387b..8ac756c675af 100644 --- a/src/components-examples/material/autocomplete/autocomplete-filter/autocomplete-filter-example.html +++ b/src/components-examples/material/autocomplete/autocomplete-filter/autocomplete-filter-example.html @@ -8,9 +8,9 @@ [formControl]="myControl" [matAutocomplete]="auto"> - - {{option}} - + @for (option of filteredOptions | async; track option) { + {{option}} + } diff --git a/src/components-examples/material/autocomplete/autocomplete-filter/autocomplete-filter-example.ts b/src/components-examples/material/autocomplete/autocomplete-filter/autocomplete-filter-example.ts index 20088741e197..17d9d844e5bf 100644 --- a/src/components-examples/material/autocomplete/autocomplete-filter/autocomplete-filter-example.ts +++ b/src/components-examples/material/autocomplete/autocomplete-filter/autocomplete-filter-example.ts @@ -2,7 +2,7 @@ import {Component, OnInit} from '@angular/core'; import {FormControl, FormsModule, ReactiveFormsModule} from '@angular/forms'; import {Observable} from 'rxjs'; import {map, startWith} from 'rxjs/operators'; -import {NgFor, AsyncPipe} from '@angular/common'; +import {AsyncPipe} from '@angular/common'; import {MatAutocompleteModule} from '@angular/material/autocomplete'; import {MatInputModule} from '@angular/material/input'; import {MatFormFieldModule} from '@angular/material/form-field'; @@ -21,7 +21,6 @@ import {MatFormFieldModule} from '@angular/material/form-field'; MatInputModule, MatAutocompleteModule, ReactiveFormsModule, - NgFor, AsyncPipe, ], }) diff --git a/src/components-examples/material/autocomplete/autocomplete-harness/autocomplete-harness-example.html b/src/components-examples/material/autocomplete/autocomplete-harness/autocomplete-harness-example.html index 9ec82cd88899..e0af7691b679 100644 --- a/src/components-examples/material/autocomplete/autocomplete-harness/autocomplete-harness-example.html +++ b/src/components-examples/material/autocomplete/autocomplete-harness/autocomplete-harness-example.html @@ -1,5 +1,7 @@ - {{ state.name }} + @for (state of states; track state) { + {{ state.name }} + } diff --git a/src/components-examples/material/autocomplete/autocomplete-harness/autocomplete-harness-example.ts b/src/components-examples/material/autocomplete/autocomplete-harness/autocomplete-harness-example.ts index d3848a54d31b..2dac7916eb30 100644 --- a/src/components-examples/material/autocomplete/autocomplete-harness/autocomplete-harness-example.ts +++ b/src/components-examples/material/autocomplete/autocomplete-harness/autocomplete-harness-example.ts @@ -1,5 +1,4 @@ import {Component} from '@angular/core'; -import {NgFor} from '@angular/common'; import {MatAutocompleteModule} from '@angular/material/autocomplete'; /** @@ -9,7 +8,7 @@ import {MatAutocompleteModule} from '@angular/material/autocomplete'; selector: 'autocomplete-harness-example', templateUrl: 'autocomplete-harness-example.html', standalone: true, - imports: [MatAutocompleteModule, NgFor], + imports: [MatAutocompleteModule], }) export class AutocompleteHarnessExample { states = [ diff --git a/src/components-examples/material/autocomplete/autocomplete-optgroup/autocomplete-optgroup-example.html b/src/components-examples/material/autocomplete/autocomplete-optgroup/autocomplete-optgroup-example.html index 8e0ccdea8130..8181071dec7a 100644 --- a/src/components-examples/material/autocomplete/autocomplete-optgroup/autocomplete-optgroup-example.html +++ b/src/components-examples/material/autocomplete/autocomplete-optgroup/autocomplete-optgroup-example.html @@ -8,11 +8,13 @@ [matAutocomplete]="autoGroup"> - - - {{name}} - - + @for (group of stateGroupOptions | async; track group) { + + @for (name of group.names; track name) { + {{name}} + } + + } diff --git a/src/components-examples/material/autocomplete/autocomplete-optgroup/autocomplete-optgroup-example.ts b/src/components-examples/material/autocomplete/autocomplete-optgroup/autocomplete-optgroup-example.ts index 055013753108..f413f5755fae 100644 --- a/src/components-examples/material/autocomplete/autocomplete-optgroup/autocomplete-optgroup-example.ts +++ b/src/components-examples/material/autocomplete/autocomplete-optgroup/autocomplete-optgroup-example.ts @@ -2,7 +2,7 @@ import {Component, OnInit} from '@angular/core'; import {FormBuilder, FormsModule, ReactiveFormsModule} from '@angular/forms'; import {Observable} from 'rxjs'; import {startWith, map} from 'rxjs/operators'; -import {NgFor, AsyncPipe} from '@angular/common'; +import {AsyncPipe} from '@angular/common'; import {MatAutocompleteModule} from '@angular/material/autocomplete'; import {MatInputModule} from '@angular/material/input'; import {MatFormFieldModule} from '@angular/material/form-field'; @@ -31,7 +31,6 @@ export const _filter = (opt: string[], value: string): string[] => { MatFormFieldModule, MatInputModule, MatAutocompleteModule, - NgFor, AsyncPipe, ], }) diff --git a/src/components-examples/material/autocomplete/autocomplete-overview/autocomplete-overview-example.html b/src/components-examples/material/autocomplete/autocomplete-overview/autocomplete-overview-example.html index 9a828b98a80f..51c22a153544 100644 --- a/src/components-examples/material/autocomplete/autocomplete-overview/autocomplete-overview-example.html +++ b/src/components-examples/material/autocomplete/autocomplete-overview/autocomplete-overview-example.html @@ -6,11 +6,13 @@ [matAutocomplete]="auto" [formControl]="stateCtrl"> - - - {{state.name}} | - Population: {{state.population}} - + @for (state of filteredStates | async; track state) { + + + {{state.name}} | + Population: {{state.population}} + + } diff --git a/src/components-examples/material/autocomplete/autocomplete-overview/autocomplete-overview-example.ts b/src/components-examples/material/autocomplete/autocomplete-overview/autocomplete-overview-example.ts index e8fefe1dd766..a2ef5ca19243 100644 --- a/src/components-examples/material/autocomplete/autocomplete-overview/autocomplete-overview-example.ts +++ b/src/components-examples/material/autocomplete/autocomplete-overview/autocomplete-overview-example.ts @@ -3,7 +3,7 @@ import {FormControl, FormsModule, ReactiveFormsModule} from '@angular/forms'; import {Observable} from 'rxjs'; import {map, startWith} from 'rxjs/operators'; import {MatSlideToggleModule} from '@angular/material/slide-toggle'; -import {NgFor, AsyncPipe} from '@angular/common'; +import {AsyncPipe} from '@angular/common'; import {MatAutocompleteModule} from '@angular/material/autocomplete'; import {MatInputModule} from '@angular/material/input'; import {MatFormFieldModule} from '@angular/material/form-field'; @@ -28,7 +28,6 @@ export interface State { MatInputModule, MatAutocompleteModule, ReactiveFormsModule, - NgFor, MatSlideToggleModule, AsyncPipe, ], diff --git a/src/components-examples/material/autocomplete/autocomplete-plain-input/autocomplete-plain-input-example.html b/src/components-examples/material/autocomplete/autocomplete-plain-input/autocomplete-plain-input-example.html index 1f94451ba956..d830477d23ca 100644 --- a/src/components-examples/material/autocomplete/autocomplete-plain-input/autocomplete-plain-input-example.html +++ b/src/components-examples/material/autocomplete/autocomplete-plain-input/autocomplete-plain-input-example.html @@ -5,8 +5,8 @@ [matAutocomplete]="auto" class="example-input"> - - {{street}} - + @for (street of filteredStreets | async; track street) { + {{street}} + } diff --git a/src/components-examples/material/autocomplete/autocomplete-plain-input/autocomplete-plain-input-example.ts b/src/components-examples/material/autocomplete/autocomplete-plain-input/autocomplete-plain-input-example.ts index 5e043b281bc4..168a3b18204c 100644 --- a/src/components-examples/material/autocomplete/autocomplete-plain-input/autocomplete-plain-input-example.ts +++ b/src/components-examples/material/autocomplete/autocomplete-plain-input/autocomplete-plain-input-example.ts @@ -2,7 +2,7 @@ import {Component, OnInit} from '@angular/core'; import {FormControl, FormsModule, ReactiveFormsModule} from '@angular/forms'; import {Observable} from 'rxjs'; import {startWith, map} from 'rxjs/operators'; -import {NgFor, AsyncPipe} from '@angular/common'; +import {AsyncPipe} from '@angular/common'; import {MatAutocompleteModule} from '@angular/material/autocomplete'; /** @@ -13,7 +13,7 @@ import {MatAutocompleteModule} from '@angular/material/autocomplete'; templateUrl: 'autocomplete-plain-input-example.html', styleUrls: ['autocomplete-plain-input-example.css'], standalone: true, - imports: [FormsModule, MatAutocompleteModule, ReactiveFormsModule, NgFor, AsyncPipe], + imports: [FormsModule, MatAutocompleteModule, ReactiveFormsModule, AsyncPipe], }) export class AutocompletePlainInputExample implements OnInit { control = new FormControl(''); diff --git a/src/components-examples/material/autocomplete/autocomplete-require-selection/autocomplete-require-selection-example.html b/src/components-examples/material/autocomplete/autocomplete-require-selection/autocomplete-require-selection-example.html index e5c96b37e9d3..e219ae709ab9 100644 --- a/src/components-examples/material/autocomplete/autocomplete-require-selection/autocomplete-require-selection-example.html +++ b/src/components-examples/material/autocomplete/autocomplete-require-selection/autocomplete-require-selection-example.html @@ -12,9 +12,9 @@ (input)="filter()" (focus)="filter()"> - - {{option}} - + @for (option of filteredOptions; track option) { + {{option}} + } diff --git a/src/components-examples/material/autocomplete/autocomplete-require-selection/autocomplete-require-selection-example.ts b/src/components-examples/material/autocomplete/autocomplete-require-selection/autocomplete-require-selection-example.ts index 5da4fc881088..42d322fbfd70 100644 --- a/src/components-examples/material/autocomplete/autocomplete-require-selection/autocomplete-require-selection-example.ts +++ b/src/components-examples/material/autocomplete/autocomplete-require-selection/autocomplete-require-selection-example.ts @@ -1,6 +1,6 @@ import {Component, ElementRef, ViewChild} from '@angular/core'; import {FormControl, FormsModule, ReactiveFormsModule} from '@angular/forms'; -import {NgFor, AsyncPipe} from '@angular/common'; +import {AsyncPipe} from '@angular/common'; import {MatAutocompleteModule} from '@angular/material/autocomplete'; import {MatInputModule} from '@angular/material/input'; import {MatFormFieldModule} from '@angular/material/form-field'; @@ -19,7 +19,6 @@ import {MatFormFieldModule} from '@angular/material/form-field'; MatInputModule, MatAutocompleteModule, ReactiveFormsModule, - NgFor, AsyncPipe, ], }) diff --git a/src/components-examples/material/autocomplete/autocomplete-simple/autocomplete-simple-example.html b/src/components-examples/material/autocomplete/autocomplete-simple/autocomplete-simple-example.html index a8332e050ee1..c3a57bceb82d 100644 --- a/src/components-examples/material/autocomplete/autocomplete-simple/autocomplete-simple-example.html +++ b/src/components-examples/material/autocomplete/autocomplete-simple/autocomplete-simple-example.html @@ -11,9 +11,9 @@ - - {{option}} - + @for (option of options; track option) { + {{option}} + } diff --git a/src/components-examples/material/autocomplete/autocomplete-simple/autocomplete-simple-example.ts b/src/components-examples/material/autocomplete/autocomplete-simple/autocomplete-simple-example.ts index 18ee25c3dde5..1cd58ba7ceef 100644 --- a/src/components-examples/material/autocomplete/autocomplete-simple/autocomplete-simple-example.ts +++ b/src/components-examples/material/autocomplete/autocomplete-simple/autocomplete-simple-example.ts @@ -1,6 +1,5 @@ import {Component} from '@angular/core'; import {FormControl, FormsModule, ReactiveFormsModule} from '@angular/forms'; -import {NgFor} from '@angular/common'; import {MatAutocompleteModule} from '@angular/material/autocomplete'; import {MatInputModule} from '@angular/material/input'; import {MatFormFieldModule} from '@angular/material/form-field'; @@ -19,7 +18,6 @@ import {MatFormFieldModule} from '@angular/material/form-field'; MatInputModule, MatAutocompleteModule, ReactiveFormsModule, - NgFor, ], }) export class AutocompleteSimpleExample { diff --git a/src/components-examples/material/checkbox/checkbox-overview/checkbox-overview-example.html b/src/components-examples/material/checkbox/checkbox-overview/checkbox-overview-example.html index 89f364c1fea8..ff06d1f31192 100644 --- a/src/components-examples/material/checkbox/checkbox-overview/checkbox-overview-example.html +++ b/src/components-examples/material/checkbox/checkbox-overview/checkbox-overview-example.html @@ -15,13 +15,15 @@
      -
    • - - {{subtask.name}} - -
    • + @for (subtask of task.subtasks; track subtask) { +
    • + + {{subtask.name}} + +
    • + }
    diff --git a/src/components-examples/material/checkbox/checkbox-overview/checkbox-overview-example.ts b/src/components-examples/material/checkbox/checkbox-overview/checkbox-overview-example.ts index 8a9dc89df453..1449ee250f02 100644 --- a/src/components-examples/material/checkbox/checkbox-overview/checkbox-overview-example.ts +++ b/src/components-examples/material/checkbox/checkbox-overview/checkbox-overview-example.ts @@ -1,7 +1,6 @@ import {Component} from '@angular/core'; import {ThemePalette} from '@angular/material/core'; import {FormsModule} from '@angular/forms'; -import {NgFor} from '@angular/common'; import {MatCheckboxModule} from '@angular/material/checkbox'; export interface Task { @@ -19,7 +18,7 @@ export interface Task { templateUrl: 'checkbox-overview-example.html', styleUrls: ['checkbox-overview-example.css'], standalone: true, - imports: [MatCheckboxModule, NgFor, FormsModule], + imports: [MatCheckboxModule, FormsModule], }) export class CheckboxOverviewExample { task: Task = { diff --git a/src/components-examples/material/chips/chips-autocomplete/chips-autocomplete-example.html b/src/components-examples/material/chips/chips-autocomplete/chips-autocomplete-example.html index e8fa8d73bfc3..0e9f4a806f2b 100644 --- a/src/components-examples/material/chips/chips-autocomplete/chips-autocomplete-example.html +++ b/src/components-examples/material/chips/chips-autocomplete/chips-autocomplete-example.html @@ -2,21 +2,23 @@ Favorite Fruits - - {{fruit}} - - + @for (fruit of fruits; track fruit) { + + {{fruit}} + + + } - - {{fruit}} - + @for (fruit of filteredFruits | async; track fruit) { + {{fruit}} + } diff --git a/src/components-examples/material/chips/chips-autocomplete/chips-autocomplete-example.ts b/src/components-examples/material/chips/chips-autocomplete/chips-autocomplete-example.ts index 9b6a27fad8bb..71b023377968 100644 --- a/src/components-examples/material/chips/chips-autocomplete/chips-autocomplete-example.ts +++ b/src/components-examples/material/chips/chips-autocomplete/chips-autocomplete-example.ts @@ -6,7 +6,7 @@ import {MatChipInputEvent, MatChipsModule} from '@angular/material/chips'; import {Observable} from 'rxjs'; import {map, startWith} from 'rxjs/operators'; import {MatIconModule} from '@angular/material/icon'; -import {NgFor, AsyncPipe} from '@angular/common'; +import {AsyncPipe} from '@angular/common'; import {MatFormFieldModule} from '@angular/material/form-field'; import {LiveAnnouncer} from '@angular/cdk/a11y'; @@ -22,7 +22,6 @@ import {LiveAnnouncer} from '@angular/cdk/a11y'; FormsModule, MatFormFieldModule, MatChipsModule, - NgFor, MatIconModule, MatAutocompleteModule, ReactiveFormsModule, diff --git a/src/components-examples/material/chips/chips-drag-drop/chips-drag-drop-example.html b/src/components-examples/material/chips/chips-drag-drop/chips-drag-drop-example.html index b695a45e3d31..774899b66afc 100644 --- a/src/components-examples/material/chips/chips-drag-drop/chips-drag-drop-example.html +++ b/src/components-examples/material/chips/chips-drag-drop/chips-drag-drop-example.html @@ -1,12 +1,9 @@ - - {{vegetable.name}} - + @for (vegetable of vegetables; track vegetable) { + {{vegetable.name}} + } diff --git a/src/components-examples/material/chips/chips-drag-drop/chips-drag-drop-example.ts b/src/components-examples/material/chips/chips-drag-drop/chips-drag-drop-example.ts index 1c5d60a490d0..130f643518cb 100644 --- a/src/components-examples/material/chips/chips-drag-drop/chips-drag-drop-example.ts +++ b/src/components-examples/material/chips/chips-drag-drop/chips-drag-drop-example.ts @@ -1,6 +1,5 @@ import {Component} from '@angular/core'; import {CdkDragDrop, moveItemInArray, CdkDrag, CdkDropList} from '@angular/cdk/drag-drop'; -import {NgFor} from '@angular/common'; import {MatChipsModule} from '@angular/material/chips'; export interface Vegetable { @@ -15,7 +14,7 @@ export interface Vegetable { templateUrl: 'chips-drag-drop-example.html', styleUrls: ['chips-drag-drop-example.css'], standalone: true, - imports: [MatChipsModule, CdkDropList, NgFor, CdkDrag], + imports: [MatChipsModule, CdkDropList, CdkDrag], }) export class ChipsDragDropExample { vegetables: Vegetable[] = [ diff --git a/src/components-examples/material/chips/chips-form-control/chips-form-control-example.html b/src/components-examples/material/chips/chips-form-control/chips-form-control-example.html index 72631a4b7cd7..d1dfeddd6c2c 100644 --- a/src/components-examples/material/chips/chips-form-control/chips-form-control-example.html +++ b/src/components-examples/material/chips/chips-form-control/chips-form-control-example.html @@ -8,12 +8,14 @@ Video keywords - - {{keyword}} - - + @for (keyword of keywords; track keyword) { + + {{keyword}} + + + } Favorite Fruits - - {{fruit.name}} - - + @for (fruit of fruits; track fruit) { + + {{fruit.name}} + + + } - - {{chip.name}} - - \ No newline at end of file + @for (chip of availableColors; track chip) { + {{chip.name}} + } + diff --git a/src/components-examples/material/chips/chips-stacked/chips-stacked-example.ts b/src/components-examples/material/chips/chips-stacked/chips-stacked-example.ts index 798e825d2c5f..0dde8fe84408 100644 --- a/src/components-examples/material/chips/chips-stacked/chips-stacked-example.ts +++ b/src/components-examples/material/chips/chips-stacked/chips-stacked-example.ts @@ -1,6 +1,5 @@ import {Component} from '@angular/core'; import {ThemePalette} from '@angular/material/core'; -import {NgFor} from '@angular/common'; import {MatChipsModule} from '@angular/material/chips'; export interface ChipColor { @@ -16,7 +15,7 @@ export interface ChipColor { templateUrl: 'chips-stacked-example.html', styleUrls: ['chips-stacked-example.css'], standalone: true, - imports: [MatChipsModule, NgFor], + imports: [MatChipsModule], }) export class ChipsStackedExample { availableColors: ChipColor[] = [ diff --git a/src/components-examples/material/datepicker/date-range-picker-forms/date-range-picker-forms-example.html b/src/components-examples/material/datepicker/date-range-picker-forms/date-range-picker-forms-example.html index 34b60d753dee..7d218f08c524 100644 --- a/src/components-examples/material/datepicker/date-range-picker-forms/date-range-picker-forms-example.html +++ b/src/components-examples/material/datepicker/date-range-picker-forms/date-range-picker-forms-example.html @@ -8,8 +8,12 @@ - Invalid start date - Invalid end date + @if (range.controls.start.hasError('matStartDateInvalid')) { + Invalid start date + } + @if (range.controls.end.hasError('matEndDateInvalid')) { + Invalid end date + }

    Selected range: {{range.value | json}}

    diff --git a/src/components-examples/material/datepicker/date-range-picker-forms/date-range-picker-forms-example.ts b/src/components-examples/material/datepicker/date-range-picker-forms/date-range-picker-forms-example.ts index 2074169d3cfa..b1b4d92a3460 100644 --- a/src/components-examples/material/datepicker/date-range-picker-forms/date-range-picker-forms-example.ts +++ b/src/components-examples/material/datepicker/date-range-picker-forms/date-range-picker-forms-example.ts @@ -1,6 +1,6 @@ import {Component} from '@angular/core'; import {FormGroup, FormControl, FormsModule, ReactiveFormsModule} from '@angular/forms'; -import {NgIf, JsonPipe} from '@angular/common'; +import {JsonPipe} from '@angular/common'; import {MatDatepickerModule} from '@angular/material/datepicker'; import {MatFormFieldModule} from '@angular/material/form-field'; import {MatNativeDateModule} from '@angular/material/core'; @@ -15,7 +15,6 @@ import {MatNativeDateModule} from '@angular/material/core'; MatDatepickerModule, FormsModule, ReactiveFormsModule, - NgIf, JsonPipe, MatNativeDateModule, ], diff --git a/src/components-examples/material/datepicker/datepicker-events/datepicker-events-example.html b/src/components-examples/material/datepicker/datepicker-events/datepicker-events-example.html index 208548d84935..1dc59fb2450d 100644 --- a/src/components-examples/material/datepicker/datepicker-events/datepicker-events-example.html +++ b/src/components-examples/material/datepicker/datepicker-events/datepicker-events-example.html @@ -8,5 +8,7 @@
    -
    {{e}}
    + @for (e of events; track e) { +
    {{e}}
    + }
    diff --git a/src/components-examples/material/datepicker/datepicker-events/datepicker-events-example.ts b/src/components-examples/material/datepicker/datepicker-events/datepicker-events-example.ts index 55c8a89fe8f3..beed6b8c22ad 100644 --- a/src/components-examples/material/datepicker/datepicker-events/datepicker-events-example.ts +++ b/src/components-examples/material/datepicker/datepicker-events/datepicker-events-example.ts @@ -1,6 +1,5 @@ import {Component} from '@angular/core'; import {MatDatepickerInputEvent, MatDatepickerModule} from '@angular/material/datepicker'; -import {NgFor} from '@angular/common'; import {MatInputModule} from '@angular/material/input'; import {MatFormFieldModule} from '@angular/material/form-field'; import {MatNativeDateModule} from '@angular/material/core'; @@ -11,7 +10,7 @@ import {MatNativeDateModule} from '@angular/material/core'; templateUrl: 'datepicker-events-example.html', styleUrls: ['datepicker-events-example.css'], standalone: true, - imports: [MatFormFieldModule, MatInputModule, MatNativeDateModule, MatDatepickerModule, NgFor], + imports: [MatFormFieldModule, MatInputModule, MatNativeDateModule, MatDatepickerModule], }) export class DatepickerEventsExample { events: string[] = []; diff --git a/src/components-examples/material/dialog/dialog-data/dialog-data-example-dialog.html b/src/components-examples/material/dialog/dialog-data/dialog-data-example-dialog.html index 6d263bacf3c9..25b007c49e65 100644 --- a/src/components-examples/material/dialog/dialog-data/dialog-data-example-dialog.html +++ b/src/components-examples/material/dialog/dialog-data/dialog-data-example-dialog.html @@ -3,13 +3,19 @@

    Favorite Animal

    My favorite animal is:
    • - Panda + @if (data.animal === 'panda') { + + } Panda
    • - Unicorn + @if (data.animal === 'unicorn') { + + } Unicorn
    • - Lion + @if (data.animal === 'lion') { + + } Lion
    diff --git a/src/components-examples/material/dialog/dialog-data/dialog-data-example.ts b/src/components-examples/material/dialog/dialog-data/dialog-data-example.ts index 54a160dc3dea..4b604892a7b2 100644 --- a/src/components-examples/material/dialog/dialog-data/dialog-data-example.ts +++ b/src/components-examples/material/dialog/dialog-data/dialog-data-example.ts @@ -1,6 +1,5 @@ import {Component, Inject} from '@angular/core'; import {MatDialog, MAT_DIALOG_DATA, MatDialogModule} from '@angular/material/dialog'; -import {NgIf} from '@angular/common'; import {MatButtonModule} from '@angular/material/button'; export interface DialogData { @@ -32,7 +31,7 @@ export class DialogDataExample { selector: 'dialog-data-example-dialog', templateUrl: 'dialog-data-example-dialog.html', standalone: true, - imports: [MatDialogModule, NgIf], + imports: [MatDialogModule], }) export class DialogDataExampleDialog { constructor(@Inject(MAT_DIALOG_DATA) public data: DialogData) {} diff --git a/src/components-examples/material/dialog/dialog-overview/dialog-overview-example.html b/src/components-examples/material/dialog/dialog-overview/dialog-overview-example.html index 5e7be5d347ca..c3f033499dad 100644 --- a/src/components-examples/material/dialog/dialog-overview/dialog-overview-example.html +++ b/src/components-examples/material/dialog/dialog-overview/dialog-overview-example.html @@ -8,7 +8,7 @@
  • -
  • - You chose: {{animal}} -
  • + @if (animal) { +
  • You chose: {{animal}}
  • + } diff --git a/src/components-examples/material/dialog/dialog-overview/dialog-overview-example.ts b/src/components-examples/material/dialog/dialog-overview/dialog-overview-example.ts index 218ed8d512fc..84a6739e3ad9 100644 --- a/src/components-examples/material/dialog/dialog-overview/dialog-overview-example.ts +++ b/src/components-examples/material/dialog/dialog-overview/dialog-overview-example.ts @@ -1,6 +1,5 @@ import {Component, Inject} from '@angular/core'; import {MatDialog, MAT_DIALOG_DATA, MatDialogRef, MatDialogModule} from '@angular/material/dialog'; -import {NgIf} from '@angular/common'; import {MatButtonModule} from '@angular/material/button'; import {FormsModule} from '@angular/forms'; import {MatInputModule} from '@angular/material/input'; @@ -18,14 +17,7 @@ export interface DialogData { selector: 'dialog-overview-example', templateUrl: 'dialog-overview-example.html', standalone: true, - imports: [ - MatFormFieldModule, - MatInputModule, - FormsModule, - MatButtonModule, - NgIf, - MatDialogModule, - ], + imports: [MatFormFieldModule, MatInputModule, FormsModule, MatButtonModule, MatDialogModule], }) export class DialogOverviewExample { animal: string; diff --git a/src/components-examples/material/form-field/form-field-error/form-field-error-example.html b/src/components-examples/material/form-field/form-field-error/form-field-error-example.html index 4e19231827fa..56c5be722ebf 100644 --- a/src/components-examples/material/form-field/form-field-error/form-field-error-example.html +++ b/src/components-examples/material/form-field/form-field-error/form-field-error-example.html @@ -2,6 +2,8 @@ Enter your email - {{getErrorMessage()}} + @if (email.invalid) { + {{getErrorMessage()}} + } diff --git a/src/components-examples/material/form-field/form-field-error/form-field-error-example.ts b/src/components-examples/material/form-field/form-field-error/form-field-error-example.ts index 46f771017105..c5a18580672e 100644 --- a/src/components-examples/material/form-field/form-field-error/form-field-error-example.ts +++ b/src/components-examples/material/form-field/form-field-error/form-field-error-example.ts @@ -1,6 +1,5 @@ import {Component} from '@angular/core'; import {FormControl, Validators, FormsModule, ReactiveFormsModule} from '@angular/forms'; -import {NgIf} from '@angular/common'; import {MatInputModule} from '@angular/material/input'; import {MatFormFieldModule} from '@angular/material/form-field'; @@ -10,7 +9,7 @@ import {MatFormFieldModule} from '@angular/material/form-field'; templateUrl: 'form-field-error-example.html', styleUrls: ['form-field-error-example.css'], standalone: true, - imports: [MatFormFieldModule, MatInputModule, FormsModule, ReactiveFormsModule, NgIf], + imports: [MatFormFieldModule, MatInputModule, FormsModule, ReactiveFormsModule], }) export class FormFieldErrorExample { email = new FormControl('', [Validators.required, Validators.email]); diff --git a/src/components-examples/material/grid-list/grid-list-dynamic/grid-list-dynamic-example.html b/src/components-examples/material/grid-list/grid-list-dynamic/grid-list-dynamic-example.html index c79507b49a6f..48eb283308bc 100644 --- a/src/components-examples/material/grid-list/grid-list-dynamic/grid-list-dynamic-example.html +++ b/src/components-examples/material/grid-list/grid-list-dynamic/grid-list-dynamic-example.html @@ -1,9 +1,8 @@ - - {{tile.text}} - + [style.background]="tile.color">{{tile.text}} + } diff --git a/src/components-examples/material/grid-list/grid-list-dynamic/grid-list-dynamic-example.ts b/src/components-examples/material/grid-list/grid-list-dynamic/grid-list-dynamic-example.ts index 6c2c35145277..a48a547a3842 100644 --- a/src/components-examples/material/grid-list/grid-list-dynamic/grid-list-dynamic-example.ts +++ b/src/components-examples/material/grid-list/grid-list-dynamic/grid-list-dynamic-example.ts @@ -1,5 +1,4 @@ import {Component} from '@angular/core'; -import {NgFor} from '@angular/common'; import {MatGridListModule} from '@angular/material/grid-list'; export interface Tile { @@ -16,7 +15,7 @@ export interface Tile { selector: 'grid-list-dynamic-example', templateUrl: 'grid-list-dynamic-example.html', standalone: true, - imports: [MatGridListModule, NgFor], + imports: [MatGridListModule], }) export class GridListDynamicExample { tiles: Tile[] = [ diff --git a/src/components-examples/material/input/input-clearable/input-clearable-example.html b/src/components-examples/material/input/input-clearable/input-clearable-example.html index 82e3c9fc48cd..3d7d9a985f9d 100644 --- a/src/components-examples/material/input/input-clearable/input-clearable-example.html +++ b/src/components-examples/material/input/input-clearable/input-clearable-example.html @@ -1,7 +1,9 @@ Clearable input - + @if (value) { + + } diff --git a/src/components-examples/material/input/input-clearable/input-clearable-example.ts b/src/components-examples/material/input/input-clearable/input-clearable-example.ts index 326826be3ee7..4daccba02bf0 100644 --- a/src/components-examples/material/input/input-clearable/input-clearable-example.ts +++ b/src/components-examples/material/input/input-clearable/input-clearable-example.ts @@ -1,7 +1,6 @@ import {Component} from '@angular/core'; import {MatIconModule} from '@angular/material/icon'; import {MatButtonModule} from '@angular/material/button'; -import {NgIf} from '@angular/common'; import {FormsModule} from '@angular/forms'; import {MatInputModule} from '@angular/material/input'; import {MatFormFieldModule} from '@angular/material/form-field'; @@ -14,7 +13,7 @@ import {MatFormFieldModule} from '@angular/material/form-field'; templateUrl: './input-clearable-example.html', styleUrls: ['./input-clearable-example.css'], standalone: true, - imports: [MatFormFieldModule, MatInputModule, FormsModule, NgIf, MatButtonModule, MatIconModule], + imports: [MatFormFieldModule, MatInputModule, FormsModule, MatButtonModule, MatIconModule], }) export class InputClearableExample { value = 'Clear me'; diff --git a/src/components-examples/material/input/input-error-state-matcher/input-error-state-matcher-example.html b/src/components-examples/material/input/input-error-state-matcher/input-error-state-matcher-example.html index fecd22f0c4bf..a40618bf738d 100644 --- a/src/components-examples/material/input/input-error-state-matcher/input-error-state-matcher-example.html +++ b/src/components-examples/material/input/input-error-state-matcher/input-error-state-matcher-example.html @@ -4,11 +4,11 @@ Errors appear instantly! - - Please enter a valid email address - - - Email is required - + @if (emailFormControl.hasError('email') && !emailFormControl.hasError('required')) { + Please enter a valid email address + } + @if (emailFormControl.hasError('required')) { + Email is required + } diff --git a/src/components-examples/material/input/input-error-state-matcher/input-error-state-matcher-example.ts b/src/components-examples/material/input/input-error-state-matcher/input-error-state-matcher-example.ts index 17d969377565..690a8b6da144 100644 --- a/src/components-examples/material/input/input-error-state-matcher/input-error-state-matcher-example.ts +++ b/src/components-examples/material/input/input-error-state-matcher/input-error-state-matcher-example.ts @@ -8,7 +8,6 @@ import { ReactiveFormsModule, } from '@angular/forms'; import {ErrorStateMatcher} from '@angular/material/core'; -import {NgIf} from '@angular/common'; import {MatInputModule} from '@angular/material/input'; import {MatFormFieldModule} from '@angular/material/form-field'; @@ -26,7 +25,7 @@ export class MyErrorStateMatcher implements ErrorStateMatcher { templateUrl: './input-error-state-matcher-example.html', styleUrls: ['./input-error-state-matcher-example.css'], standalone: true, - imports: [FormsModule, MatFormFieldModule, MatInputModule, ReactiveFormsModule, NgIf], + imports: [FormsModule, MatFormFieldModule, MatInputModule, ReactiveFormsModule], }) export class InputErrorStateMatcherExample { emailFormControl = new FormControl('', [Validators.required, Validators.email]); diff --git a/src/components-examples/material/input/input-errors/input-errors-example.html b/src/components-examples/material/input/input-errors/input-errors-example.html index 12cd2e99961b..bb4afaae5f3e 100644 --- a/src/components-examples/material/input/input-errors/input-errors-example.html +++ b/src/components-examples/material/input/input-errors/input-errors-example.html @@ -2,11 +2,11 @@ Email - - Please enter a valid email address - - - Email is required - + @if (emailFormControl.hasError('email') && !emailFormControl.hasError('required')) { + Please enter a valid email address + } + @if (emailFormControl.hasError('required')) { + Email is required + } diff --git a/src/components-examples/material/input/input-errors/input-errors-example.ts b/src/components-examples/material/input/input-errors/input-errors-example.ts index 6d2a6acfd3a2..c23f6b83ced6 100644 --- a/src/components-examples/material/input/input-errors/input-errors-example.ts +++ b/src/components-examples/material/input/input-errors/input-errors-example.ts @@ -1,6 +1,5 @@ import {Component} from '@angular/core'; import {FormControl, Validators, FormsModule, ReactiveFormsModule} from '@angular/forms'; -import {NgIf} from '@angular/common'; import {MatInputModule} from '@angular/material/input'; import {MatFormFieldModule} from '@angular/material/form-field'; @@ -12,7 +11,7 @@ import {MatFormFieldModule} from '@angular/material/form-field'; templateUrl: 'input-errors-example.html', styleUrls: ['input-errors-example.css'], standalone: true, - imports: [FormsModule, MatFormFieldModule, MatInputModule, ReactiveFormsModule, NgIf], + imports: [FormsModule, MatFormFieldModule, MatInputModule, ReactiveFormsModule], }) export class InputErrorsExample { emailFormControl = new FormControl('', [Validators.required, Validators.email]); diff --git a/src/components-examples/material/list/list-sections/list-sections-example.html b/src/components-examples/material/list/list-sections/list-sections-example.html index 98156571a877..644a37e844d2 100644 --- a/src/components-examples/material/list/list-sections/list-sections-example.html +++ b/src/components-examples/material/list/list-sections/list-sections-example.html @@ -1,15 +1,19 @@
    Folders
    - - folder -
    {{folder.name}}
    -
    {{folder.updated | date}}
    -
    + @for (folder of folders; track folder) { + + folder +
    {{folder.name}}
    +
    {{folder.updated | date}}
    +
    + }
    Notes
    - - note -
    {{note.name}}
    -
    {{note.updated | date}}
    -
    + @for (note of notes; track note) { + + note +
    {{note.name}}
    +
    {{note.updated | date}}
    +
    + }
    diff --git a/src/components-examples/material/list/list-sections/list-sections-example.ts b/src/components-examples/material/list/list-sections/list-sections-example.ts index 0bdbf01af0d6..a6b2bc21ae01 100644 --- a/src/components-examples/material/list/list-sections/list-sections-example.ts +++ b/src/components-examples/material/list/list-sections/list-sections-example.ts @@ -1,7 +1,7 @@ import {Component} from '@angular/core'; import {MatDividerModule} from '@angular/material/divider'; import {MatIconModule} from '@angular/material/icon'; -import {NgFor, DatePipe} from '@angular/common'; +import {DatePipe} from '@angular/common'; import {MatListModule} from '@angular/material/list'; export interface Section { @@ -17,7 +17,7 @@ export interface Section { styleUrls: ['list-sections-example.css'], templateUrl: 'list-sections-example.html', standalone: true, - imports: [MatListModule, NgFor, MatIconModule, MatDividerModule, DatePipe], + imports: [MatListModule, MatIconModule, MatDividerModule, DatePipe], }) export class ListSectionsExample { folders: Section[] = [ diff --git a/src/components-examples/material/list/list-selection/list-selection-example.html b/src/components-examples/material/list/list-selection/list-selection-example.html index d068febecc21..a269256b20a8 100644 --- a/src/components-examples/material/list/list-selection/list-selection-example.html +++ b/src/components-examples/material/list/list-selection/list-selection-example.html @@ -1,7 +1,7 @@ - - {{shoe}} - + @for (shoe of typesOfShoes; track shoe) { + {{shoe}} + }

    diff --git a/src/components-examples/material/list/list-selection/list-selection-example.ts b/src/components-examples/material/list/list-selection/list-selection-example.ts index 2d5c04ecb1a5..2209654a7771 100644 --- a/src/components-examples/material/list/list-selection/list-selection-example.ts +++ b/src/components-examples/material/list/list-selection/list-selection-example.ts @@ -1,5 +1,4 @@ import {Component} from '@angular/core'; -import {NgFor} from '@angular/common'; import {MatListModule} from '@angular/material/list'; /** @@ -9,7 +8,7 @@ import {MatListModule} from '@angular/material/list'; selector: 'list-selection-example', templateUrl: 'list-selection-example.html', standalone: true, - imports: [MatListModule, NgFor], + imports: [MatListModule], }) export class ListSelectionExample { typesOfShoes: string[] = ['Boots', 'Clogs', 'Loafers', 'Moccasins', 'Sneakers']; diff --git a/src/components-examples/material/list/list-single-selection/list-single-selection-example.html b/src/components-examples/material/list/list-single-selection/list-single-selection-example.html index c08d6106d477..0c653bd3b6da 100644 --- a/src/components-examples/material/list/list-single-selection/list-single-selection-example.html +++ b/src/components-examples/material/list/list-single-selection/list-single-selection-example.html @@ -1,7 +1,7 @@ - - {{shoe}} - + @for (shoe of typesOfShoes; track shoe) { + {{shoe}} + }

    diff --git a/src/components-examples/material/list/list-single-selection/list-single-selection-example.ts b/src/components-examples/material/list/list-single-selection/list-single-selection-example.ts index c9a06a75e45c..c848f921fe8c 100644 --- a/src/components-examples/material/list/list-single-selection/list-single-selection-example.ts +++ b/src/components-examples/material/list/list-single-selection/list-single-selection-example.ts @@ -1,5 +1,4 @@ import {Component} from '@angular/core'; -import {NgFor} from '@angular/common'; import {MatListModule} from '@angular/material/list'; /** @@ -9,7 +8,7 @@ import {MatListModule} from '@angular/material/list'; selector: 'list-single-selection-example', templateUrl: 'list-single-selection-example.html', standalone: true, - imports: [MatListModule, NgFor], + imports: [MatListModule], }) export class ListSingleSelectionExample { typesOfShoes: string[] = ['Boots', 'Clogs', 'Loafers', 'Moccasins', 'Sneakers']; diff --git a/src/components-examples/material/progress-bar/progress-bar-configurable/progress-bar-configurable-example.html b/src/components-examples/material/progress-bar/progress-bar-configurable/progress-bar-configurable-example.html index 1e658b2cced3..100f7afff8fc 100644 --- a/src/components-examples/material/progress-bar/progress-bar-configurable/progress-bar-configurable-example.html +++ b/src/components-examples/material/progress-bar/progress-bar-configurable/progress-bar-configurable-example.html @@ -35,18 +35,22 @@

    Progress bar configuration

    -
    - - - - -
    -
    - - - - -
    + @if (mode === 'determinate' || mode === 'buffer') { +
    + + + + +
    + } + @if (mode === 'buffer') { +
    + + + + +
    + } diff --git a/src/components-examples/material/progress-bar/progress-bar-configurable/progress-bar-configurable-example.ts b/src/components-examples/material/progress-bar/progress-bar-configurable/progress-bar-configurable-example.ts index 34fccfdc820e..0bf1fb2e69d1 100644 --- a/src/components-examples/material/progress-bar/progress-bar-configurable/progress-bar-configurable-example.ts +++ b/src/components-examples/material/progress-bar/progress-bar-configurable/progress-bar-configurable-example.ts @@ -2,7 +2,6 @@ import {Component} from '@angular/core'; import {ThemePalette} from '@angular/material/core'; import {ProgressBarMode, MatProgressBarModule} from '@angular/material/progress-bar'; import {MatSliderModule} from '@angular/material/slider'; -import {NgIf} from '@angular/common'; import {FormsModule} from '@angular/forms'; import {MatRadioModule} from '@angular/material/radio'; import {MatCardModule} from '@angular/material/card'; @@ -15,14 +14,7 @@ import {MatCardModule} from '@angular/material/card'; templateUrl: 'progress-bar-configurable-example.html', styleUrls: ['progress-bar-configurable-example.css'], standalone: true, - imports: [ - MatCardModule, - MatRadioModule, - FormsModule, - NgIf, - MatSliderModule, - MatProgressBarModule, - ], + imports: [MatCardModule, MatRadioModule, FormsModule, MatSliderModule, MatProgressBarModule], }) export class ProgressBarConfigurableExample { color: ThemePalette = 'primary'; diff --git a/src/components-examples/material/progress-spinner/progress-spinner-configurable/progress-spinner-configurable-example.html b/src/components-examples/material/progress-spinner/progress-spinner-configurable/progress-spinner-configurable-example.html index 8de6e3fdc460..27c9712774d0 100644 --- a/src/components-examples/material/progress-spinner/progress-spinner-configurable/progress-spinner-configurable-example.html +++ b/src/components-examples/material/progress-spinner/progress-spinner-configurable/progress-spinner-configurable-example.html @@ -29,12 +29,14 @@

    Progress spinner configuration

    -
    - - - - -
    + @if (mode === 'determinate') { +
    + + + + +
    + } diff --git a/src/components-examples/material/progress-spinner/progress-spinner-configurable/progress-spinner-configurable-example.ts b/src/components-examples/material/progress-spinner/progress-spinner-configurable/progress-spinner-configurable-example.ts index 9317f7cac678..a6cf3c5a6b6c 100644 --- a/src/components-examples/material/progress-spinner/progress-spinner-configurable/progress-spinner-configurable-example.ts +++ b/src/components-examples/material/progress-spinner/progress-spinner-configurable/progress-spinner-configurable-example.ts @@ -2,7 +2,6 @@ import {Component} from '@angular/core'; import {ThemePalette} from '@angular/material/core'; import {ProgressSpinnerMode, MatProgressSpinnerModule} from '@angular/material/progress-spinner'; import {MatSliderModule} from '@angular/material/slider'; -import {NgIf} from '@angular/common'; import {FormsModule} from '@angular/forms'; import {MatRadioModule} from '@angular/material/radio'; import {MatCardModule} from '@angular/material/card'; @@ -15,14 +14,7 @@ import {MatCardModule} from '@angular/material/card'; templateUrl: 'progress-spinner-configurable-example.html', styleUrls: ['progress-spinner-configurable-example.css'], standalone: true, - imports: [ - MatCardModule, - MatRadioModule, - FormsModule, - NgIf, - MatSliderModule, - MatProgressSpinnerModule, - ], + imports: [MatCardModule, MatRadioModule, FormsModule, MatSliderModule, MatProgressSpinnerModule], }) export class ProgressSpinnerConfigurableExample { color: ThemePalette = 'primary'; diff --git a/src/components-examples/material/radio/radio-ng-model/radio-ng-model-example.html b/src/components-examples/material/radio/radio-ng-model/radio-ng-model-example.html index 5369faa5589b..2908217637ae 100644 --- a/src/components-examples/material/radio/radio-ng-model/radio-ng-model-example.html +++ b/src/components-examples/material/radio/radio-ng-model/radio-ng-model-example.html @@ -3,8 +3,8 @@ aria-labelledby="example-radio-group-label" class="example-radio-group" [(ngModel)]="favoriteSeason"> - - {{season}} - + @for (season of seasons; track season) { + {{season}} + }
    Your favorite season is: {{favoriteSeason}}
    diff --git a/src/components-examples/material/radio/radio-ng-model/radio-ng-model-example.ts b/src/components-examples/material/radio/radio-ng-model/radio-ng-model-example.ts index c2ecf4d85d95..6af67740ee0f 100644 --- a/src/components-examples/material/radio/radio-ng-model/radio-ng-model-example.ts +++ b/src/components-examples/material/radio/radio-ng-model/radio-ng-model-example.ts @@ -1,5 +1,4 @@ import {Component} from '@angular/core'; -import {NgFor} from '@angular/common'; import {FormsModule} from '@angular/forms'; import {MatRadioModule} from '@angular/material/radio'; @@ -11,7 +10,7 @@ import {MatRadioModule} from '@angular/material/radio'; templateUrl: 'radio-ng-model-example.html', styleUrls: ['radio-ng-model-example.css'], standalone: true, - imports: [MatRadioModule, FormsModule, NgFor], + imports: [MatRadioModule, FormsModule], }) export class RadioNgModelExample { favoriteSeason: string; diff --git a/src/components-examples/material/select/select-custom-trigger/select-custom-trigger-example.html b/src/components-examples/material/select/select-custom-trigger/select-custom-trigger-example.html index e768a8908899..522a6b329b9a 100644 --- a/src/components-examples/material/select/select-custom-trigger/select-custom-trigger-example.html +++ b/src/components-examples/material/select/select-custom-trigger/select-custom-trigger-example.html @@ -3,10 +3,14 @@ {{toppings.value?.[0] || ''}} - - (+{{(toppings.value?.length || 0) - 1}} {{toppings.value?.length === 2 ? 'other' : 'others'}}) - + @if ((toppings.value?.length || 0) > 1) { + + (+{{(toppings.value?.length || 0) - 1}} {{toppings.value?.length === 2 ? 'other' : 'others'}}) + + } - {{topping}} + @for (topping of toppingList; track topping) { + {{topping}} +} diff --git a/src/components-examples/material/select/select-custom-trigger/select-custom-trigger-example.ts b/src/components-examples/material/select/select-custom-trigger/select-custom-trigger-example.ts index 40f94c5e9476..98fbd0cf8f8c 100644 --- a/src/components-examples/material/select/select-custom-trigger/select-custom-trigger-example.ts +++ b/src/components-examples/material/select/select-custom-trigger/select-custom-trigger-example.ts @@ -1,6 +1,5 @@ import {Component} from '@angular/core'; import {FormControl, FormsModule, ReactiveFormsModule} from '@angular/forms'; -import {NgIf, NgFor} from '@angular/common'; import {MatSelectModule} from '@angular/material/select'; import {MatFormFieldModule} from '@angular/material/form-field'; @@ -10,7 +9,7 @@ import {MatFormFieldModule} from '@angular/material/form-field'; templateUrl: 'select-custom-trigger-example.html', styleUrls: ['select-custom-trigger-example.css'], standalone: true, - imports: [MatFormFieldModule, MatSelectModule, FormsModule, ReactiveFormsModule, NgIf, NgFor], + imports: [MatFormFieldModule, MatSelectModule, FormsModule, ReactiveFormsModule], }) export class SelectCustomTriggerExample { toppings = new FormControl(''); diff --git a/src/components-examples/material/select/select-error-state-matcher/select-error-state-matcher-example.html b/src/components-examples/material/select/select-error-state-matcher/select-error-state-matcher-example.html index 9e5f17b1a027..8e4c2143599e 100644 --- a/src/components-examples/material/select/select-error-state-matcher/select-error-state-matcher-example.html +++ b/src/components-examples/material/select/select-error-state-matcher/select-error-state-matcher-example.html @@ -7,10 +7,12 @@

    mat-select

    Invalid option Errors appear instantly! - You must make a selection - - Your selection is invalid - + @if (selected.hasError('required')) { + You must make a selection + } + @if (selected.hasError('pattern') && !selected.hasError('required')) { + Your selection is invalid + }

    native html select

    @@ -21,8 +23,10 @@

    native html select

    - You must make a selection - - Your selection is invalid - + @if (nativeSelectFormControl.hasError('required')) { + You must make a selection + } + @if (nativeSelectFormControl.hasError('pattern') && !nativeSelectFormControl.hasError('required')) { + Your selection is invalid + } diff --git a/src/components-examples/material/select/select-error-state-matcher/select-error-state-matcher-example.ts b/src/components-examples/material/select/select-error-state-matcher/select-error-state-matcher-example.ts index 6b6bdc8e5adb..5d590fc02348 100644 --- a/src/components-examples/material/select/select-error-state-matcher/select-error-state-matcher-example.ts +++ b/src/components-examples/material/select/select-error-state-matcher/select-error-state-matcher-example.ts @@ -9,7 +9,6 @@ import { } from '@angular/forms'; import {ErrorStateMatcher} from '@angular/material/core'; import {MatInputModule} from '@angular/material/input'; -import {NgIf} from '@angular/common'; import {MatSelectModule} from '@angular/material/select'; import {MatFormFieldModule} from '@angular/material/form-field'; @@ -26,14 +25,7 @@ export class MyErrorStateMatcher implements ErrorStateMatcher { selector: 'select-error-state-matcher-example', templateUrl: 'select-error-state-matcher-example.html', standalone: true, - imports: [ - MatFormFieldModule, - MatSelectModule, - FormsModule, - ReactiveFormsModule, - NgIf, - MatInputModule, - ], + imports: [MatFormFieldModule, MatSelectModule, FormsModule, ReactiveFormsModule, MatInputModule], }) export class SelectErrorStateMatcherExample { selected = new FormControl('valid', [Validators.required, Validators.pattern('valid')]); diff --git a/src/components-examples/material/select/select-form/select-form-example.html b/src/components-examples/material/select/select-form/select-form-example.html index f2b02b6a4e56..3b04b2847f74 100644 --- a/src/components-examples/material/select/select-form/select-form-example.html +++ b/src/components-examples/material/select/select-form/select-form-example.html @@ -3,9 +3,9 @@

    mat-select

    Favorite food - - {{food.viewValue}} - + @for (food of foods; track food) { + {{food.viewValue}} + }

    Selected food: {{selectedValue}}

    @@ -14,9 +14,9 @@

    native html select

    Favorite car

    Selected car: {{selectedCar}}

    diff --git a/src/components-examples/material/select/select-form/select-form-example.ts b/src/components-examples/material/select/select-form/select-form-example.ts index 5e87a68ea320..e06de0971da4 100644 --- a/src/components-examples/material/select/select-form/select-form-example.ts +++ b/src/components-examples/material/select/select-form/select-form-example.ts @@ -1,6 +1,5 @@ import {Component} from '@angular/core'; import {MatInputModule} from '@angular/material/input'; -import {NgFor} from '@angular/common'; import {MatSelectModule} from '@angular/material/select'; import {MatFormFieldModule} from '@angular/material/form-field'; import {FormsModule} from '@angular/forms'; @@ -22,7 +21,7 @@ interface Car { selector: 'select-form-example', templateUrl: 'select-form-example.html', standalone: true, - imports: [FormsModule, MatFormFieldModule, MatSelectModule, NgFor, MatInputModule], + imports: [FormsModule, MatFormFieldModule, MatSelectModule, MatInputModule], }) export class SelectFormExample { selectedValue: string; diff --git a/src/components-examples/material/select/select-harness/select-harness-example.html b/src/components-examples/material/select/select-harness/select-harness-example.html index e41f610c08d1..687e19334a62 100644 --- a/src/components-examples/material/select/select-harness/select-harness-example.html +++ b/src/components-examples/material/select/select-harness/select-harness-example.html @@ -1,8 +1,8 @@ Favorite food - - {{food.viewValue}} - + @for (food of foods; track food) { + {{food.viewValue}} + } diff --git a/src/components-examples/material/select/select-harness/select-harness-example.ts b/src/components-examples/material/select/select-harness/select-harness-example.ts index 5c7347f61b31..d1ea9f2108fa 100644 --- a/src/components-examples/material/select/select-harness/select-harness-example.ts +++ b/src/components-examples/material/select/select-harness/select-harness-example.ts @@ -1,5 +1,4 @@ import {Component} from '@angular/core'; -import {NgFor} from '@angular/common'; import {MatSelectModule} from '@angular/material/select'; import {MatFormFieldModule} from '@angular/material/form-field'; @@ -10,7 +9,7 @@ import {MatFormFieldModule} from '@angular/material/form-field'; selector: 'select-harness-example', templateUrl: 'select-harness-example.html', standalone: true, - imports: [MatFormFieldModule, MatSelectModule, NgFor], + imports: [MatFormFieldModule, MatSelectModule], }) export class SelectHarnessExample { foods = [ diff --git a/src/components-examples/material/select/select-hint-error/select-hint-error-example.html b/src/components-examples/material/select/select-hint-error/select-hint-error-example.html index d10b0d422ea4..75909c429dc0 100644 --- a/src/components-examples/material/select/select-hint-error/select-hint-error-example.html +++ b/src/components-examples/material/select/select-hint-error/select-hint-error-example.html @@ -3,11 +3,13 @@

    mat select

    Favorite animal -- - - {{animal.name}} - + @for (animal of animals; track animal) { + {{animal.name}} + } - Please choose an animal + @if (animalControl.hasError('required')) { + Please choose an animal + } {{animalControl.value?.sound}} @@ -20,9 +22,9 @@

    native html select

    - - This field is required - + @if (selectFormControl.hasError('required')) { + This field is required + } You can pick up your favorite car here diff --git a/src/components-examples/material/select/select-hint-error/select-hint-error-example.ts b/src/components-examples/material/select/select-hint-error/select-hint-error-example.ts index 653d4958ba15..736d88f74557 100644 --- a/src/components-examples/material/select/select-hint-error/select-hint-error-example.ts +++ b/src/components-examples/material/select/select-hint-error/select-hint-error-example.ts @@ -1,7 +1,6 @@ import {Component} from '@angular/core'; import {FormControl, Validators, FormsModule, ReactiveFormsModule} from '@angular/forms'; import {MatInputModule} from '@angular/material/input'; -import {NgFor, NgIf} from '@angular/common'; import {MatSelectModule} from '@angular/material/select'; import {MatFormFieldModule} from '@angular/material/form-field'; @@ -15,15 +14,7 @@ interface Animal { selector: 'select-hint-error-example', templateUrl: 'select-hint-error-example.html', standalone: true, - imports: [ - MatFormFieldModule, - MatSelectModule, - FormsModule, - ReactiveFormsModule, - NgFor, - NgIf, - MatInputModule, - ], + imports: [MatFormFieldModule, MatSelectModule, FormsModule, ReactiveFormsModule, MatInputModule], }) export class SelectHintErrorExample { animalControl = new FormControl(null, Validators.required); diff --git a/src/components-examples/material/select/select-initial-value/select-initial-value-example.html b/src/components-examples/material/select/select-initial-value/select-initial-value-example.html index a1cf4d269b7a..40d617b8346e 100644 --- a/src/components-examples/material/select/select-initial-value/select-initial-value-example.html +++ b/src/components-examples/material/select/select-initial-value/select-initial-value-example.html @@ -3,7 +3,9 @@

    Basic mat-select with initial value

    Favorite Food - {{ option.viewValue }} + @for (option of foods; track option) { + {{ option.viewValue }} + }

    You selected: {{selectedFood}}

    @@ -13,8 +15,10 @@

    Basic native select with initial value

    Favorite Car

    You selected: {{selectedCar}}

    diff --git a/src/components-examples/material/select/select-initial-value/select-initial-value-example.ts b/src/components-examples/material/select/select-initial-value/select-initial-value-example.ts index 0688b7f3539f..dfa6782a0eef 100644 --- a/src/components-examples/material/select/select-initial-value/select-initial-value-example.ts +++ b/src/components-examples/material/select/select-initial-value/select-initial-value-example.ts @@ -1,7 +1,6 @@ import {Component} from '@angular/core'; import {FormsModule} from '@angular/forms'; import {MatInputModule} from '@angular/material/input'; -import {NgFor} from '@angular/common'; import {MatSelectModule} from '@angular/material/select'; import {MatFormFieldModule} from '@angular/material/form-field'; @@ -22,7 +21,7 @@ interface Car { selector: 'select-initial-value-example', templateUrl: 'select-initial-value-example.html', standalone: true, - imports: [MatFormFieldModule, MatSelectModule, NgFor, MatInputModule, FormsModule], + imports: [MatFormFieldModule, MatSelectModule, MatInputModule, FormsModule], }) export class SelectInitialValueExample { foods: Food[] = [ diff --git a/src/components-examples/material/select/select-multiple/select-multiple-example.html b/src/components-examples/material/select/select-multiple/select-multiple-example.html index 2f617c7221fc..1387a62bd98c 100644 --- a/src/components-examples/material/select/select-multiple/select-multiple-example.html +++ b/src/components-examples/material/select/select-multiple/select-multiple-example.html @@ -1,6 +1,8 @@ Toppings - {{topping}} + @for (topping of toppingList; track topping) { + {{topping}} + } diff --git a/src/components-examples/material/select/select-multiple/select-multiple-example.ts b/src/components-examples/material/select/select-multiple/select-multiple-example.ts index 9d9368ab49ab..e3994c7eeec8 100644 --- a/src/components-examples/material/select/select-multiple/select-multiple-example.ts +++ b/src/components-examples/material/select/select-multiple/select-multiple-example.ts @@ -1,6 +1,5 @@ import {Component} from '@angular/core'; import {FormControl, FormsModule, ReactiveFormsModule} from '@angular/forms'; -import {NgFor} from '@angular/common'; import {MatSelectModule} from '@angular/material/select'; import {MatFormFieldModule} from '@angular/material/form-field'; @@ -9,7 +8,7 @@ import {MatFormFieldModule} from '@angular/material/form-field'; selector: 'select-multiple-example', templateUrl: 'select-multiple-example.html', standalone: true, - imports: [MatFormFieldModule, MatSelectModule, FormsModule, ReactiveFormsModule, NgFor], + imports: [MatFormFieldModule, MatSelectModule, FormsModule, ReactiveFormsModule], }) export class SelectMultipleExample { toppings = new FormControl(''); diff --git a/src/components-examples/material/select/select-optgroup/select-optgroup-example.html b/src/components-examples/material/select/select-optgroup/select-optgroup-example.html index 6482720884ee..df813e5aae53 100644 --- a/src/components-examples/material/select/select-optgroup/select-optgroup-example.html +++ b/src/components-examples/material/select/select-optgroup/select-optgroup-example.html @@ -3,12 +3,14 @@

    mat-select

    Pokemon -- None -- - - - {{pokemon.viewValue}} - - + @for (group of pokemonGroups; track group) { + + @for (pokemon of group.pokemon; track pokemon) { + {{pokemon.viewValue}} + } + + } diff --git a/src/components-examples/material/select/select-optgroup/select-optgroup-example.ts b/src/components-examples/material/select/select-optgroup/select-optgroup-example.ts index ee9c68e9a00b..58704a50f630 100644 --- a/src/components-examples/material/select/select-optgroup/select-optgroup-example.ts +++ b/src/components-examples/material/select/select-optgroup/select-optgroup-example.ts @@ -1,7 +1,6 @@ import {Component} from '@angular/core'; import {FormControl, FormsModule, ReactiveFormsModule} from '@angular/forms'; import {MatInputModule} from '@angular/material/input'; -import {NgFor} from '@angular/common'; import {MatSelectModule} from '@angular/material/select'; import {MatFormFieldModule} from '@angular/material/form-field'; @@ -21,14 +20,7 @@ interface PokemonGroup { selector: 'select-optgroup-example', templateUrl: 'select-optgroup-example.html', standalone: true, - imports: [ - MatFormFieldModule, - MatSelectModule, - FormsModule, - ReactiveFormsModule, - NgFor, - MatInputModule, - ], + imports: [MatFormFieldModule, MatSelectModule, FormsModule, ReactiveFormsModule, MatInputModule], }) export class SelectOptgroupExample { pokemonControl = new FormControl(''); diff --git a/src/components-examples/material/select/select-overview/select-overview-example.html b/src/components-examples/material/select/select-overview/select-overview-example.html index d7df8280eee0..7c3edf7a3a4a 100644 --- a/src/components-examples/material/select/select-overview/select-overview-example.html +++ b/src/components-examples/material/select/select-overview/select-overview-example.html @@ -2,9 +2,9 @@

    Basic mat-select

    Favorite food - - {{food.viewValue}} - + @for (food of foods; track food) { + {{food.viewValue}} + } diff --git a/src/components-examples/material/select/select-overview/select-overview-example.ts b/src/components-examples/material/select/select-overview/select-overview-example.ts index 99ff745ba3ea..58de4dea6016 100644 --- a/src/components-examples/material/select/select-overview/select-overview-example.ts +++ b/src/components-examples/material/select/select-overview/select-overview-example.ts @@ -1,7 +1,6 @@ import {Component} from '@angular/core'; import {FormsModule} from '@angular/forms'; import {MatInputModule} from '@angular/material/input'; -import {NgFor} from '@angular/common'; import {MatSelectModule} from '@angular/material/select'; import {MatFormFieldModule} from '@angular/material/form-field'; @@ -17,7 +16,7 @@ interface Food { selector: 'select-overview-example', templateUrl: 'select-overview-example.html', standalone: true, - imports: [MatFormFieldModule, MatSelectModule, NgFor, MatInputModule, FormsModule], + imports: [MatFormFieldModule, MatSelectModule, MatInputModule, FormsModule], }) export class SelectOverviewExample { foods: Food[] = [ diff --git a/src/components-examples/material/select/select-reactive-form/select-reactive-form-example.html b/src/components-examples/material/select/select-reactive-form/select-reactive-form-example.html index cd7458a8e5af..f3b0bd18ceb0 100644 --- a/src/components-examples/material/select/select-reactive-form/select-reactive-form-example.html +++ b/src/components-examples/material/select/select-reactive-form/select-reactive-form-example.html @@ -4,9 +4,9 @@

    mat-select

    Favorite Food None - - {{food.viewValue}} - + @for (food of foods; track food) { + {{food.viewValue}} + }

    Selected: {{foodControl.value}}

    @@ -15,9 +15,9 @@

    Native select

    Favorite Car

    Selected: {{carControl.value}}

    diff --git a/src/components-examples/material/select/select-reactive-form/select-reactive-form-example.ts b/src/components-examples/material/select/select-reactive-form/select-reactive-form-example.ts index 816341b06dff..67f07d8003ba 100644 --- a/src/components-examples/material/select/select-reactive-form/select-reactive-form-example.ts +++ b/src/components-examples/material/select/select-reactive-form/select-reactive-form-example.ts @@ -1,7 +1,6 @@ import {Component} from '@angular/core'; import {FormControl, FormGroup, FormsModule, ReactiveFormsModule} from '@angular/forms'; import {MatInputModule} from '@angular/material/input'; -import {NgFor} from '@angular/common'; import {MatSelectModule} from '@angular/material/select'; import {MatFormFieldModule} from '@angular/material/form-field'; @@ -22,14 +21,7 @@ interface Car { selector: 'select-reactive-form-example', templateUrl: 'select-reactive-form-example.html', standalone: true, - imports: [ - FormsModule, - ReactiveFormsModule, - MatFormFieldModule, - MatSelectModule, - NgFor, - MatInputModule, - ], + imports: [FormsModule, ReactiveFormsModule, MatFormFieldModule, MatSelectModule, MatInputModule], }) export class SelectReactiveFormExample { foods: Food[] = [ diff --git a/src/components-examples/material/select/select-reset/select-reset-example.html b/src/components-examples/material/select/select-reset/select-reset-example.html index e0f734507aab..0b89556937b1 100644 --- a/src/components-examples/material/select/select-reset/select-reset-example.html +++ b/src/components-examples/material/select/select-reset/select-reset-example.html @@ -3,7 +3,9 @@

    mat-select

    State None - {{state}} + @for (state of states; track state) { + {{state}} + } diff --git a/src/components-examples/material/select/select-reset/select-reset-example.ts b/src/components-examples/material/select/select-reset/select-reset-example.ts index 1275ecdad9f2..b1fca8b81469 100644 --- a/src/components-examples/material/select/select-reset/select-reset-example.ts +++ b/src/components-examples/material/select/select-reset/select-reset-example.ts @@ -1,7 +1,6 @@ import {Component} from '@angular/core'; import {FormsModule} from '@angular/forms'; import {MatInputModule} from '@angular/material/input'; -import {NgFor} from '@angular/common'; import {MatSelectModule} from '@angular/material/select'; import {MatFormFieldModule} from '@angular/material/form-field'; @@ -10,7 +9,7 @@ import {MatFormFieldModule} from '@angular/material/form-field'; selector: 'select-reset-example', templateUrl: 'select-reset-example.html', standalone: true, - imports: [MatFormFieldModule, MatSelectModule, NgFor, MatInputModule, FormsModule], + imports: [MatFormFieldModule, MatSelectModule, MatInputModule, FormsModule], }) export class SelectResetExample { states: string[] = [ diff --git a/src/components-examples/material/sidenav/sidenav-autosize/sidenav-autosize-example.html b/src/components-examples/material/sidenav/sidenav-autosize/sidenav-autosize-example.html index f9326a3846f3..98e69a1c2c1d 100644 --- a/src/components-examples/material/sidenav/sidenav-autosize/sidenav-autosize-example.html +++ b/src/components-examples/material/sidenav/sidenav-autosize/sidenav-autosize-example.html @@ -1,7 +1,9 @@

    Auto-resizing sidenav

    -

    Lorem, ipsum dolor sit amet consectetur.

    + @if (showFiller) { +

    Lorem, ipsum dolor sit amet consectetur.

    + } diff --git a/src/components-examples/material/sidenav/sidenav-autosize/sidenav-autosize-example.ts b/src/components-examples/material/sidenav/sidenav-autosize/sidenav-autosize-example.ts index 8d7cc2a368a0..d6eea4d561e3 100644 --- a/src/components-examples/material/sidenav/sidenav-autosize/sidenav-autosize-example.ts +++ b/src/components-examples/material/sidenav/sidenav-autosize/sidenav-autosize-example.ts @@ -1,6 +1,5 @@ import {Component} from '@angular/core'; import {MatButtonModule} from '@angular/material/button'; -import {NgIf} from '@angular/common'; import {MatSidenavModule} from '@angular/material/sidenav'; /** @@ -11,7 +10,7 @@ import {MatSidenavModule} from '@angular/material/sidenav'; templateUrl: 'sidenav-autosize-example.html', styleUrls: ['sidenav-autosize-example.css'], standalone: true, - imports: [MatSidenavModule, NgIf, MatButtonModule], + imports: [MatSidenavModule, MatButtonModule], }) export class SidenavAutosizeExample { showFiller = false; diff --git a/src/components-examples/material/sidenav/sidenav-configurable-focus-trap/sidenav-configurable-focus-trap-example.html b/src/components-examples/material/sidenav/sidenav-configurable-focus-trap/sidenav-configurable-focus-trap-example.html index e9542d34307c..e6b0821ca811 100644 --- a/src/components-examples/material/sidenav/sidenav-configurable-focus-trap/sidenav-configurable-focus-trap-example.html +++ b/src/components-examples/material/sidenav/sidenav-configurable-focus-trap/sidenav-configurable-focus-trap-example.html @@ -1,36 +1,39 @@ - - -

    -

    - -

    -
    +@if (shouldRun) { + + +

    +

    + +

    +
    - -

    -

    - - - Over - Side - Push - - - - Default - true - false - - - - Start - End - -

    -

    - -

    -
    -
    + +

    +

    + + + Over + Side + Push + + + + Default + true + false + + + + Start + End + +

    +

    + +

    +
    +
    +} @else { +
    Please open on Stackblitz to see result
    +} -
    Please open on Stackblitz to see result
    diff --git a/src/components-examples/material/sidenav/sidenav-configurable-focus-trap/sidenav-configurable-focus-trap-example.ts b/src/components-examples/material/sidenav/sidenav-configurable-focus-trap/sidenav-configurable-focus-trap-example.ts index f397fcd2d04d..b8361413683c 100644 --- a/src/components-examples/material/sidenav/sidenav-configurable-focus-trap/sidenav-configurable-focus-trap-example.ts +++ b/src/components-examples/material/sidenav/sidenav-configurable-focus-trap/sidenav-configurable-focus-trap-example.ts @@ -1,5 +1,4 @@ import {Component} from '@angular/core'; -import {NgIf} from '@angular/common'; import {FormControl, FormsModule, ReactiveFormsModule} from '@angular/forms'; import {MatDrawerMode, MatSidenavModule} from '@angular/material/sidenav'; import {MatRadioModule} from '@angular/material/radio'; @@ -12,14 +11,7 @@ import {ConfigurableFocusTrapFactory, FocusTrapFactory} from '@angular/cdk/a11y' templateUrl: 'sidenav-configurable-focus-trap-example.html', styleUrls: ['sidenav-configurable-focus-trap-example.css'], standalone: true, - imports: [ - NgIf, - MatSidenavModule, - MatButtonModule, - MatRadioModule, - FormsModule, - ReactiveFormsModule, - ], + imports: [MatSidenavModule, MatButtonModule, MatRadioModule, FormsModule, ReactiveFormsModule], providers: [{provide: FocusTrapFactory, useClass: ConfigurableFocusTrapFactory}], }) export class SidenavConfigurableFocusTrapExample { diff --git a/src/components-examples/material/sidenav/sidenav-disable-close/sidenav-disable-close-example.html b/src/components-examples/material/sidenav/sidenav-disable-close/sidenav-disable-close-example.html index 4d861c83410c..fada970cd015 100644 --- a/src/components-examples/material/sidenav/sidenav-disable-close/sidenav-disable-close-example.html +++ b/src/components-examples/material/sidenav/sidenav-disable-close/sidenav-disable-close-example.html @@ -1,13 +1,15 @@ - - -

    -
    +@if (shouldRun) { + + +

    +
    - -

    -

    Closed due to: {{reason}}

    -
    -
    - -
    Please open on Stackblitz to see result
    + +

    +

    Closed due to: {{reason}}

    +
    +
    +} @else { +
    Please open on Stackblitz to see result
    +} diff --git a/src/components-examples/material/sidenav/sidenav-disable-close/sidenav-disable-close-example.ts b/src/components-examples/material/sidenav/sidenav-disable-close/sidenav-disable-close-example.ts index 67361e126f2e..7f21079abbae 100644 --- a/src/components-examples/material/sidenav/sidenav-disable-close/sidenav-disable-close-example.ts +++ b/src/components-examples/material/sidenav/sidenav-disable-close/sidenav-disable-close-example.ts @@ -1,7 +1,6 @@ import {Component, ViewChild} from '@angular/core'; import {MatSidenav, MatSidenavModule} from '@angular/material/sidenav'; import {MatButtonModule} from '@angular/material/button'; -import {NgIf} from '@angular/common'; /** @title Sidenav with custom escape and backdrop click behavior */ @Component({ @@ -9,7 +8,7 @@ import {NgIf} from '@angular/common'; templateUrl: 'sidenav-disable-close-example.html', styleUrls: ['sidenav-disable-close-example.css'], standalone: true, - imports: [NgIf, MatSidenavModule, MatButtonModule], + imports: [MatSidenavModule, MatButtonModule], }) export class SidenavDisableCloseExample { @ViewChild('sidenav') sidenav: MatSidenav; diff --git a/src/components-examples/material/sidenav/sidenav-fixed/sidenav-fixed-example.html b/src/components-examples/material/sidenav/sidenav-fixed/sidenav-fixed-example.html index d43ed7fe251a..9880c28eddb1 100644 --- a/src/components-examples/material/sidenav/sidenav-fixed/sidenav-fixed-example.html +++ b/src/components-examples/material/sidenav/sidenav-fixed/sidenav-fixed-example.html @@ -1,4 +1,4 @@ - +@if (shouldRun) { Header @@ -23,6 +23,6 @@ Footer - - -
    Please open on StackBlitz to see result
    +} @else { +
    Please open on StackBlitz to see result
    +} diff --git a/src/components-examples/material/sidenav/sidenav-fixed/sidenav-fixed-example.ts b/src/components-examples/material/sidenav/sidenav-fixed/sidenav-fixed-example.ts index 893e2080ed17..3ad9ff1e2db2 100644 --- a/src/components-examples/material/sidenav/sidenav-fixed/sidenav-fixed-example.ts +++ b/src/components-examples/material/sidenav/sidenav-fixed/sidenav-fixed-example.ts @@ -6,7 +6,6 @@ import {MatCheckboxModule} from '@angular/material/checkbox'; import {MatSidenavModule} from '@angular/material/sidenav'; import {MatToolbarModule} from '@angular/material/toolbar'; import {MatInputModule} from '@angular/material/input'; -import {NgIf} from '@angular/common'; /** @title Fixed sidenav */ @Component({ @@ -15,7 +14,6 @@ import {NgIf} from '@angular/common'; styleUrls: ['sidenav-fixed-example.css'], standalone: true, imports: [ - NgIf, MatToolbarModule, MatSidenavModule, FormsModule, diff --git a/src/components-examples/material/sidenav/sidenav-mode/sidenav-mode-example.html b/src/components-examples/material/sidenav/sidenav-mode/sidenav-mode-example.html index d26f9dee6fb5..04f8b534ac73 100644 --- a/src/components-examples/material/sidenav/sidenav-mode/sidenav-mode-example.html +++ b/src/components-examples/material/sidenav/sidenav-mode/sidenav-mode-example.html @@ -1,27 +1,30 @@ - - -

    -

    - - - Over - Side - Push - -

    -
    +@if (shouldRun) { + + +

    +

    + + + Over + Side + Push + +

    +
    - -

    -

    - - - Over - Side - Push - -

    -
    -
    + +

    +

    + + + Over + Side + Push + +

    +
    +
    +} @else { +
    Please open on Stackblitz to see result
    +} -
    Please open on Stackblitz to see result
    diff --git a/src/components-examples/material/sidenav/sidenav-mode/sidenav-mode-example.ts b/src/components-examples/material/sidenav/sidenav-mode/sidenav-mode-example.ts index 55412ee2d2df..cd02ec9c7aa2 100644 --- a/src/components-examples/material/sidenav/sidenav-mode/sidenav-mode-example.ts +++ b/src/components-examples/material/sidenav/sidenav-mode/sidenav-mode-example.ts @@ -1,5 +1,4 @@ import {Component} from '@angular/core'; -import {NgIf} from '@angular/common'; import {FormControl, FormsModule, ReactiveFormsModule} from '@angular/forms'; import {MatDrawerMode, MatSidenavModule} from '@angular/material/sidenav'; import {MatRadioModule} from '@angular/material/radio'; @@ -11,14 +10,7 @@ import {MatButtonModule} from '@angular/material/button'; templateUrl: 'sidenav-mode-example.html', styleUrls: ['sidenav-mode-example.css'], standalone: true, - imports: [ - NgIf, - MatSidenavModule, - MatButtonModule, - MatRadioModule, - FormsModule, - ReactiveFormsModule, - ], + imports: [MatSidenavModule, MatButtonModule, MatRadioModule, FormsModule, ReactiveFormsModule], }) export class SidenavModeExample { mode = new FormControl('over' as MatDrawerMode); diff --git a/src/components-examples/material/sidenav/sidenav-open-close/sidenav-open-close-example.html b/src/components-examples/material/sidenav/sidenav-open-close/sidenav-open-close-example.html index 82cf9382b03c..f82321e94337 100644 --- a/src/components-examples/material/sidenav/sidenav-open-close/sidenav-open-close-example.html +++ b/src/components-examples/material/sidenav/sidenav-open-close/sidenav-open-close-example.html @@ -1,17 +1,22 @@ - - - Sidenav content - +@if (shouldRun) { + + + Sidenav content + - -

    sidenav.opened

    -

    -

    Events:

    -
    -
    {{e}}
    -
    -
    -
    + +

    sidenav.opened

    +

    +

    Events:

    +
    + @for (e of events; track e) { +
    {{e}}
    + } +
    +
    +
    +} @else { +
    Please open on Stackblitz to see result
    +} -
    Please open on Stackblitz to see result
    diff --git a/src/components-examples/material/sidenav/sidenav-open-close/sidenav-open-close-example.ts b/src/components-examples/material/sidenav/sidenav-open-close/sidenav-open-close-example.ts index b7c095783a7f..c49a7a5521bf 100644 --- a/src/components-examples/material/sidenav/sidenav-open-close/sidenav-open-close-example.ts +++ b/src/components-examples/material/sidenav/sidenav-open-close/sidenav-open-close-example.ts @@ -3,7 +3,6 @@ import {MatButtonModule} from '@angular/material/button'; import {FormsModule} from '@angular/forms'; import {MatCheckboxModule} from '@angular/material/checkbox'; import {MatSidenavModule} from '@angular/material/sidenav'; -import {NgIf, NgFor} from '@angular/common'; /** @title Sidenav open & close behavior */ @Component({ @@ -11,7 +10,7 @@ import {NgIf, NgFor} from '@angular/common'; templateUrl: 'sidenav-open-close-example.html', styleUrls: ['sidenav-open-close-example.css'], standalone: true, - imports: [NgIf, MatSidenavModule, MatCheckboxModule, FormsModule, MatButtonModule, NgFor], + imports: [MatSidenavModule, MatCheckboxModule, FormsModule, MatButtonModule], }) export class SidenavOpenCloseExample { events: string[] = []; diff --git a/src/components-examples/material/sidenav/sidenav-overview/sidenav-overview-example.html b/src/components-examples/material/sidenav/sidenav-overview/sidenav-overview-example.html index bb50d519621e..acbdbe728516 100644 --- a/src/components-examples/material/sidenav/sidenav-overview/sidenav-overview-example.html +++ b/src/components-examples/material/sidenav/sidenav-overview/sidenav-overview-example.html @@ -1,6 +1,8 @@ - - Sidenav content - Main content - - -
    Please open on Stackblitz to see result
    +@if (shouldRun) { + + Sidenav content + Main content + +} @else { +
    Please open on Stackblitz to see result
    +} diff --git a/src/components-examples/material/sidenav/sidenav-overview/sidenav-overview-example.ts b/src/components-examples/material/sidenav/sidenav-overview/sidenav-overview-example.ts index 76bd2bd42a80..b9ee6ac6ac98 100644 --- a/src/components-examples/material/sidenav/sidenav-overview/sidenav-overview-example.ts +++ b/src/components-examples/material/sidenav/sidenav-overview/sidenav-overview-example.ts @@ -1,6 +1,5 @@ import {Component} from '@angular/core'; import {MatSidenavModule} from '@angular/material/sidenav'; -import {NgIf} from '@angular/common'; /** @title Basic sidenav */ @Component({ @@ -8,7 +7,7 @@ import {NgIf} from '@angular/common'; templateUrl: 'sidenav-overview-example.html', styleUrls: ['sidenav-overview-example.css'], standalone: true, - imports: [NgIf, MatSidenavModule], + imports: [MatSidenavModule], }) export class SidenavOverviewExample { shouldRun = /(^|.)(stackblitz|webcontainer).(io|com)$/.test(window.location.host); diff --git a/src/components-examples/material/sidenav/sidenav-position/sidenav-position-example.html b/src/components-examples/material/sidenav/sidenav-position/sidenav-position-example.html index d45f0e8cb0a1..3319e1452401 100644 --- a/src/components-examples/material/sidenav/sidenav-position/sidenav-position-example.html +++ b/src/components-examples/material/sidenav/sidenav-position/sidenav-position-example.html @@ -1,7 +1,9 @@ - - Start content - End content - Implicit main content - - -
    Please open on Stackblitz to see result
    +@if (shouldRun) { + + Start content + End content + Implicit main content + +} @else { +
    Please open on Stackblitz to see result
    +} diff --git a/src/components-examples/material/sidenav/sidenav-position/sidenav-position-example.ts b/src/components-examples/material/sidenav/sidenav-position/sidenav-position-example.ts index 3169bcaf54d0..250d7611486b 100644 --- a/src/components-examples/material/sidenav/sidenav-position/sidenav-position-example.ts +++ b/src/components-examples/material/sidenav/sidenav-position/sidenav-position-example.ts @@ -1,6 +1,5 @@ import {Component} from '@angular/core'; import {MatSidenavModule} from '@angular/material/sidenav'; -import {NgIf} from '@angular/common'; /** @title Implicit main content with two sidenavs */ @Component({ @@ -8,7 +7,7 @@ import {NgIf} from '@angular/common'; templateUrl: 'sidenav-position-example.html', styleUrls: ['sidenav-position-example.css'], standalone: true, - imports: [NgIf, MatSidenavModule], + imports: [MatSidenavModule], }) export class SidenavPositionExample { shouldRun = /(^|.)(stackblitz|webcontainer).(io|com)$/.test(window.location.host); diff --git a/src/components-examples/material/sidenav/sidenav-responsive/sidenav-responsive-example.html b/src/components-examples/material/sidenav/sidenav-responsive/sidenav-responsive-example.html index b12947dfd237..7a51a65fc95f 100644 --- a/src/components-examples/material/sidenav/sidenav-responsive/sidenav-responsive-example.html +++ b/src/components-examples/material/sidenav/sidenav-responsive/sidenav-responsive-example.html @@ -1,22 +1,28 @@ -
    - - -

    Responsive App

    -
    +@if (shouldRun) { +
    + + +

    Responsive App

    +
    - - - - {{nav}} - - + + + + @for (nav of fillerNav; track nav) { + {{nav}} + } + + - -

    {{content}}

    -
    -
    -
    - -
    Please open on Stackblitz to see result
    + + @for (content of fillerContent; track content) { +

    {{content}}

    + } +
    + +
    +} @else { +
    Please open on Stackblitz to see result
    +} diff --git a/src/components-examples/material/sidenav/sidenav-responsive/sidenav-responsive-example.ts b/src/components-examples/material/sidenav/sidenav-responsive/sidenav-responsive-example.ts index d5953f61b831..89287e19af34 100644 --- a/src/components-examples/material/sidenav/sidenav-responsive/sidenav-responsive-example.ts +++ b/src/components-examples/material/sidenav/sidenav-responsive/sidenav-responsive-example.ts @@ -5,7 +5,6 @@ import {MatSidenavModule} from '@angular/material/sidenav'; import {MatIconModule} from '@angular/material/icon'; import {MatButtonModule} from '@angular/material/button'; import {MatToolbarModule} from '@angular/material/toolbar'; -import {NgIf, NgFor} from '@angular/common'; /** @title Responsive sidenav */ @Component({ @@ -13,15 +12,7 @@ import {NgIf, NgFor} from '@angular/common'; templateUrl: 'sidenav-responsive-example.html', styleUrls: ['sidenav-responsive-example.css'], standalone: true, - imports: [ - NgIf, - MatToolbarModule, - MatButtonModule, - MatIconModule, - MatSidenavModule, - MatListModule, - NgFor, - ], + imports: [MatToolbarModule, MatButtonModule, MatIconModule, MatSidenavModule, MatListModule], }) export class SidenavResponsiveExample implements OnDestroy { mobileQuery: MediaQueryList; diff --git a/src/components-examples/material/sort/sort-harness/sort-harness-example.html b/src/components-examples/material/sort/sort-harness/sort-harness-example.html index 377a0bc51923..b269a5ea4d65 100644 --- a/src/components-examples/material/sort/sort-harness/sort-harness-example.html +++ b/src/components-examples/material/sort/sort-harness/sort-harness-example.html @@ -7,11 +7,13 @@ Protein - - {{dessert.name}} - {{dessert.calories}} - {{dessert.fat}} - {{dessert.carbs}} - {{dessert.protein}} - + @for (dessert of sortedData; track dessert) { + + {{dessert.name}} + {{dessert.calories}} + {{dessert.fat}} + {{dessert.carbs}} + {{dessert.protein}} + + } diff --git a/src/components-examples/material/sort/sort-harness/sort-harness-example.ts b/src/components-examples/material/sort/sort-harness/sort-harness-example.ts index 10f8833a8ca5..90fad6b82d64 100644 --- a/src/components-examples/material/sort/sort-harness/sort-harness-example.ts +++ b/src/components-examples/material/sort/sort-harness/sort-harness-example.ts @@ -1,6 +1,5 @@ import {Component} from '@angular/core'; import {Sort, MatSortModule} from '@angular/material/sort'; -import {NgFor} from '@angular/common'; /** * @title Testing with MatSortHarness @@ -9,7 +8,7 @@ import {NgFor} from '@angular/common'; selector: 'sort-harness-example', templateUrl: 'sort-harness-example.html', standalone: true, - imports: [MatSortModule, NgFor], + imports: [MatSortModule], }) export class SortHarnessExample { disableThirdHeader = false; diff --git a/src/components-examples/material/sort/sort-overview/sort-overview-example.html b/src/components-examples/material/sort/sort-overview/sort-overview-example.html index 2b970af18c6a..94591483711a 100644 --- a/src/components-examples/material/sort/sort-overview/sort-overview-example.html +++ b/src/components-examples/material/sort/sort-overview/sort-overview-example.html @@ -7,11 +7,13 @@ Protein (g) - - {{dessert.name}} - {{dessert.calories}} - {{dessert.fat}} - {{dessert.carbs}} - {{dessert.protein}} - + @for (dessert of sortedData; track dessert) { + + {{dessert.name}} + {{dessert.calories}} + {{dessert.fat}} + {{dessert.carbs}} + {{dessert.protein}} + + } diff --git a/src/components-examples/material/sort/sort-overview/sort-overview-example.ts b/src/components-examples/material/sort/sort-overview/sort-overview-example.ts index f233e5ac556f..4a42ae23586a 100644 --- a/src/components-examples/material/sort/sort-overview/sort-overview-example.ts +++ b/src/components-examples/material/sort/sort-overview/sort-overview-example.ts @@ -1,6 +1,5 @@ import {Component} from '@angular/core'; import {Sort, MatSortModule} from '@angular/material/sort'; -import {NgFor} from '@angular/common'; export interface Dessert { calories: number; @@ -18,7 +17,7 @@ export interface Dessert { templateUrl: 'sort-overview-example.html', styleUrls: ['sort-overview-example.css'], standalone: true, - imports: [MatSortModule, NgFor], + imports: [MatSortModule], }) export class SortOverviewExample { desserts: Dessert[] = [ diff --git a/src/components-examples/material/stepper/stepper-intl/stepper-intl-example.html b/src/components-examples/material/stepper/stepper-intl/stepper-intl-example.html index 07bb9f8670a3..c108f1673094 100644 --- a/src/components-examples/material/stepper/stepper-intl/stepper-intl-example.html +++ b/src/components-examples/material/stepper/stepper-intl/stepper-intl-example.html @@ -4,12 +4,11 @@ class="demo-radio-group" [(ngModel)]="optionalLabelText" (ngModelChange)="updateOptionalLabel()"> - - {{optionalLabelTextChoice}} - + @for (optionalLabelTextChoice of optionalLabelTextChoices; track optionalLabelTextChoice) { + {{optionalLabelTextChoice}} + } diff --git a/src/components-examples/material/stepper/stepper-intl/stepper-intl-example.ts b/src/components-examples/material/stepper/stepper-intl/stepper-intl-example.ts index bbaf8c8b4a76..305f4ff45daa 100644 --- a/src/components-examples/material/stepper/stepper-intl/stepper-intl-example.ts +++ b/src/components-examples/material/stepper/stepper-intl/stepper-intl-example.ts @@ -4,7 +4,6 @@ import {MatStepperIntl, MatStepperModule} from '@angular/material/stepper'; import {MatButtonModule} from '@angular/material/button'; import {MatInputModule} from '@angular/material/input'; import {MatFormFieldModule} from '@angular/material/form-field'; -import {NgFor} from '@angular/common'; import {MatRadioModule} from '@angular/material/radio'; @Injectable() @@ -25,7 +24,6 @@ export class StepperIntl extends MatStepperIntl { imports: [ MatRadioModule, FormsModule, - NgFor, MatStepperModule, ReactiveFormsModule, MatFormFieldModule, @@ -43,7 +41,10 @@ export class StepperIntlExample { secondCtrl: ['', Validators.required], }); - constructor(private _formBuilder: FormBuilder, private _matStepperIntl: MatStepperIntl) {} + constructor( + private _formBuilder: FormBuilder, + private _matStepperIntl: MatStepperIntl, + ) {} updateOptionalLabel() { this._matStepperIntl.optionalLabel = this.optionalLabelText; diff --git a/src/components-examples/material/stepper/stepper-responsive/stepper-responsive-example.html b/src/components-examples/material/stepper/stepper-responsive/stepper-responsive-example.html index 3db8423dcf64..cba6751334d8 100644 --- a/src/components-examples/material/stepper/stepper-responsive/stepper-responsive-example.html +++ b/src/components-examples/material/stepper/stepper-responsive/stepper-responsive-example.html @@ -1,7 +1,11 @@ - -
    Make your screen smaller to see a vertical stepper
    -
    Make your screen larger to see a horizontal stepper
    -
    +@switch (stepperOrientation | async) { + @case ('horizontal') { +
    Make your screen smaller to see a vertical stepper
    + } + @case ('vertical') { +
    Make your screen larger to see a horizontal stepper
    + } +} ; - constructor(private _formBuilder: FormBuilder, breakpointObserver: BreakpointObserver) { + constructor( + private _formBuilder: FormBuilder, + breakpointObserver: BreakpointObserver, + ) { this.stepperOrientation = breakpointObserver .observe('(min-width: 800px)') .pipe(map(({matches}) => (matches ? 'horizontal' : 'vertical'))); diff --git a/src/components-examples/material/table/table-dynamic-columns/table-dynamic-columns-example.html b/src/components-examples/material/table/table-dynamic-columns/table-dynamic-columns-example.html index 9d2fcac7ac34..11f1e22047a7 100644 --- a/src/components-examples/material/table/table-dynamic-columns/table-dynamic-columns-example.html +++ b/src/components-examples/material/table/table-dynamic-columns/table-dynamic-columns-example.html @@ -3,10 +3,12 @@ - - - - + @for (column of displayedColumns; track column) { + + + + + } diff --git a/src/components-examples/material/table/table-dynamic-columns/table-dynamic-columns-example.ts b/src/components-examples/material/table/table-dynamic-columns/table-dynamic-columns-example.ts index a89b508d9976..acb4b6dd04d9 100644 --- a/src/components-examples/material/table/table-dynamic-columns/table-dynamic-columns-example.ts +++ b/src/components-examples/material/table/table-dynamic-columns/table-dynamic-columns-example.ts @@ -1,5 +1,4 @@ import {Component} from '@angular/core'; -import {NgFor} from '@angular/common'; import {MatTableModule} from '@angular/material/table'; import {MatButtonModule} from '@angular/material/button'; @@ -31,7 +30,7 @@ const ELEMENT_DATA: PeriodicElement[] = [ styleUrls: ['table-dynamic-columns-example.css'], templateUrl: 'table-dynamic-columns-example.html', standalone: true, - imports: [MatButtonModule, MatTableModule, NgFor], + imports: [MatButtonModule, MatTableModule], }) export class TableDynamicColumnsExample { displayedColumns: string[] = ['name', 'weight', 'symbol', 'position']; diff --git a/src/components-examples/material/table/table-expandable-rows/table-expandable-rows-example.html b/src/components-examples/material/table/table-expandable-rows/table-expandable-rows-example.html index 132dcd9f3f2f..2b3080096152 100644 --- a/src/components-examples/material/table/table-expandable-rows/table-expandable-rows-example.html +++ b/src/components-examples/material/table/table-expandable-rows/table-expandable-rows-example.html @@ -1,16 +1,21 @@
    {{column}} {{element[column]}} {{column}} {{element[column]}}
    - - - - + @for (column of columnsToDisplay; track column) { + + + + + } diff --git a/src/components-examples/material/table/table-expandable-rows/table-expandable-rows-example.ts b/src/components-examples/material/table/table-expandable-rows/table-expandable-rows-example.ts index 27f8278cc003..3d2ee793e40a 100644 --- a/src/components-examples/material/table/table-expandable-rows/table-expandable-rows-example.ts +++ b/src/components-examples/material/table/table-expandable-rows/table-expandable-rows-example.ts @@ -2,7 +2,6 @@ import {Component} from '@angular/core'; import {animate, state, style, transition, trigger} from '@angular/animations'; import {MatIconModule} from '@angular/material/icon'; import {MatButtonModule} from '@angular/material/button'; -import {NgFor, NgIf} from '@angular/common'; import {MatTableModule} from '@angular/material/table'; /** @@ -20,7 +19,7 @@ import {MatTableModule} from '@angular/material/table'; ]), ], standalone: true, - imports: [MatTableModule, NgFor, MatButtonModule, NgIf, MatIconModule], + imports: [MatTableModule, MatButtonModule, MatIconModule], }) export class TableExpandableRowsExample { dataSource = ELEMENT_DATA; diff --git a/src/components-examples/material/table/table-generated-columns/table-generated-columns-example.html b/src/components-examples/material/table/table-generated-columns/table-generated-columns-example.html index c1b5fa29128f..110b906e2b9f 100644 --- a/src/components-examples/material/table/table-generated-columns/table-generated-columns-example.html +++ b/src/components-examples/material/table/table-generated-columns/table-generated-columns-example.html @@ -1,12 +1,14 @@
    {{column}} {{element[column]}} {{column}} {{element[column]}}  
    - - - - + @for (column of columns; track column) { + + + + + } diff --git a/src/components-examples/material/table/table-generated-columns/table-generated-columns-example.ts b/src/components-examples/material/table/table-generated-columns/table-generated-columns-example.ts index b2916d90fa68..4689722972ac 100644 --- a/src/components-examples/material/table/table-generated-columns/table-generated-columns-example.ts +++ b/src/components-examples/material/table/table-generated-columns/table-generated-columns-example.ts @@ -1,5 +1,4 @@ import {Component} from '@angular/core'; -import {NgFor} from '@angular/common'; import {MatTableModule} from '@angular/material/table'; export interface PeriodicElement { @@ -23,14 +22,14 @@ const ELEMENT_DATA: PeriodicElement[] = [ ]; /** - * @title Table with columns defined using ngFor instead of statically written in the template. + * @title Table with columns defined using a for loop instead of statically written in the template. */ @Component({ selector: 'table-generated-columns-example', styleUrls: ['table-generated-columns-example.css'], templateUrl: 'table-generated-columns-example.html', standalone: true, - imports: [MatTableModule, NgFor], + imports: [MatTableModule], }) export class TableGeneratedColumnsExample { columns = [ diff --git a/src/components-examples/material/table/table-http/table-http-example.html b/src/components-examples/material/table/table-http/table-http-example.html index 355ae60b0ff2..a30712cafa22 100644 --- a/src/components-examples/material/table/table-http/table-http-example.html +++ b/src/components-examples/material/table/table-http/table-http-example.html @@ -1,11 +1,16 @@
    -
    - -
    - GitHub's API rate limit has been reached. It will be reset in one minute. + @if (isLoadingResults || isRateLimitReached) { +
    + @if (isLoadingResults) { + + } + @if (isRateLimitReached) { +
    + GitHub's API rate limit has been reached. It will be reset in one minute. +
    + }
    -
    + }
    diff --git a/src/components-examples/material/table/table-http/table-http-example.ts b/src/components-examples/material/table/table-http/table-http-example.ts index 168367832c73..daf8dc01f8c0 100644 --- a/src/components-examples/material/table/table-http/table-http-example.ts +++ b/src/components-examples/material/table/table-http/table-http-example.ts @@ -6,7 +6,7 @@ import {merge, Observable, of as observableOf} from 'rxjs'; import {catchError, map, startWith, switchMap} from 'rxjs/operators'; import {MatTableModule} from '@angular/material/table'; import {MatProgressSpinnerModule} from '@angular/material/progress-spinner'; -import {NgIf, DatePipe} from '@angular/common'; +import {DatePipe} from '@angular/common'; /** * @title Table retrieving data through HTTP @@ -16,14 +16,7 @@ import {NgIf, DatePipe} from '@angular/common'; styleUrls: ['table-http-example.css'], templateUrl: 'table-http-example.html', standalone: true, - imports: [ - NgIf, - MatProgressSpinnerModule, - MatTableModule, - MatSortModule, - MatPaginatorModule, - DatePipe, - ], + imports: [MatProgressSpinnerModule, MatTableModule, MatSortModule, MatPaginatorModule, DatePipe], }) export class TableHttpExample implements AfterViewInit { displayedColumns: string[] = ['created', 'state', 'number', 'title']; diff --git a/src/components-examples/material/table/table-row-binding/table-row-binding-example.html b/src/components-examples/material/table/table-row-binding/table-row-binding-example.html index d8ecfda58fd4..26e24ab03718 100644 --- a/src/components-examples/material/table/table-row-binding/table-row-binding-example.html +++ b/src/components-examples/material/table/table-row-binding/table-row-binding-example.html @@ -38,12 +38,12 @@

    -
    - Clicked rows will be logged here -
    +@if (!clickedRows.size) { +
    Clicked rows will be logged here
    +}
      -
    • - Clicked on {{clickedRow.name}} -
    • + @for (clickedRow of clickedRows; track clickedRow) { +
    • Clicked on {{clickedRow.name}}
    • + }
    diff --git a/src/components-examples/material/table/table-row-binding/table-row-binding-example.ts b/src/components-examples/material/table/table-row-binding/table-row-binding-example.ts index bf6d22faa22e..4b5f58f6a236 100644 --- a/src/components-examples/material/table/table-row-binding/table-row-binding-example.ts +++ b/src/components-examples/material/table/table-row-binding/table-row-binding-example.ts @@ -1,5 +1,4 @@ import {Component} from '@angular/core'; -import {NgIf, NgFor} from '@angular/common'; import {MatTableModule} from '@angular/material/table'; export interface PeriodicElement { @@ -30,7 +29,7 @@ const ELEMENT_DATA: PeriodicElement[] = [ styleUrls: ['table-row-binding-example.css'], templateUrl: 'table-row-binding-example.html', standalone: true, - imports: [MatTableModule, NgIf, NgFor], + imports: [MatTableModule], }) export class TableRowBindingExample { displayedColumns: string[] = ['position', 'name', 'weight', 'symbol']; diff --git a/src/components-examples/material/table/table-sticky-complex-flex/table-sticky-complex-flex-example.html b/src/components-examples/material/table/table-sticky-complex-flex/table-sticky-complex-flex-example.html index 2914a3087f20..c9d1430b595b 100644 --- a/src/components-examples/material/table/table-sticky-complex-flex/table-sticky-complex-flex-example.html +++ b/src/components-examples/material/table/table-sticky-complex-flex/table-sticky-complex-flex-example.html @@ -36,43 +36,45 @@
    - - - Position - {{element.position}} - Position Footer - + @for (table of tables; track table) { + + + Position + {{element.position}} + Position Footer + - - Name - {{element.name}} - Name Footer - + + Name + {{element.name}} + Name Footer + - - Weight - {{element.weight}} - Weight Footer - + + Weight + {{element.weight}} + Weight Footer + - - Symbol - {{element.symbol}} - Symbol Footer - + + Symbol + {{element.symbol}} + Symbol Footer + - - Filler header cell - Filler data cell - Filler footer cell - + + Filler header cell + Filler data cell + Filler footer cell + - - + + - + - - - + + + + }
    diff --git a/src/components-examples/material/table/table-sticky-complex-flex/table-sticky-complex-flex-example.ts b/src/components-examples/material/table/table-sticky-complex-flex/table-sticky-complex-flex-example.ts index b3df9c3a82e7..601b475fefa7 100644 --- a/src/components-examples/material/table/table-sticky-complex-flex/table-sticky-complex-flex-example.ts +++ b/src/components-examples/material/table/table-sticky-complex-flex/table-sticky-complex-flex-example.ts @@ -1,5 +1,4 @@ import {Component} from '@angular/core'; -import {NgFor} from '@angular/common'; import {MatButtonToggleGroup, MatButtonToggleModule} from '@angular/material/button-toggle'; import {MatTableModule} from '@angular/material/table'; import {MatButtonModule} from '@angular/material/button'; @@ -12,7 +11,7 @@ import {MatButtonModule} from '@angular/material/button'; styleUrls: ['table-sticky-complex-flex-example.css'], templateUrl: 'table-sticky-complex-flex-example.html', standalone: true, - imports: [MatButtonModule, MatButtonToggleModule, NgFor, MatTableModule], + imports: [MatButtonModule, MatButtonToggleModule, MatTableModule], }) export class TableStickyComplexFlexExample { displayedColumns: string[] = []; diff --git a/src/components-examples/material/table/table-sticky-complex/table-sticky-complex-example.html b/src/components-examples/material/table/table-sticky-complex/table-sticky-complex-example.html index 2f5c1e7260f6..3a52339e40b7 100644 --- a/src/components-examples/material/table/table-sticky-complex/table-sticky-complex-example.html +++ b/src/components-examples/material/table/table-sticky-complex/table-sticky-complex-example.html @@ -36,43 +36,45 @@
    -
    - {{column.header}} - - {{column.cell(row)}} - + {{column.header}} + + {{column.cell(row)}} +
    - - - - - + @for (table of tables; track table) { +
    Position {{element.position}} Position Footer
    + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - + + - + - - -
    Position {{element.position}} Position Footer Name {{element.name}} Name Footer Name {{element.name}} Name Footer Weight {{element.weight}} Weight Footer Weight {{element.weight}} Weight Footer Symbol {{element.symbol}} Symbol Footer Symbol {{element.symbol}} Symbol Footer Filler header cell Filler data cell Filler footer cell Filler header cell Filler data cell Filler footer cell
    + + + + } diff --git a/src/components-examples/material/table/table-sticky-complex/table-sticky-complex-example.ts b/src/components-examples/material/table/table-sticky-complex/table-sticky-complex-example.ts index a5a6a92cf984..a1a505fe81db 100644 --- a/src/components-examples/material/table/table-sticky-complex/table-sticky-complex-example.ts +++ b/src/components-examples/material/table/table-sticky-complex/table-sticky-complex-example.ts @@ -1,5 +1,4 @@ import {Component} from '@angular/core'; -import {NgFor} from '@angular/common'; import {MatButtonToggleGroup, MatButtonToggleModule} from '@angular/material/button-toggle'; import {MatTableModule} from '@angular/material/table'; import {MatButtonModule} from '@angular/material/button'; @@ -12,7 +11,7 @@ import {MatButtonModule} from '@angular/material/button'; styleUrls: ['table-sticky-complex-example.css'], templateUrl: 'table-sticky-complex-example.html', standalone: true, - imports: [MatButtonModule, MatButtonToggleModule, NgFor, MatTableModule], + imports: [MatButtonModule, MatButtonToggleModule, MatTableModule], }) export class TableStickyComplexExample { displayedColumns: string[] = []; diff --git a/src/components-examples/material/tabs/tab-group-async/tab-group-async-example.html b/src/components-examples/material/tabs/tab-group-async/tab-group-async-example.html index c1f93438ca1a..a011ccc70408 100644 --- a/src/components-examples/material/tabs/tab-group-async/tab-group-async-example.html +++ b/src/components-examples/material/tabs/tab-group-async/tab-group-async-example.html @@ -1,10 +1,12 @@ - +@if ((asyncTabs | async) === null) { Loading tabs... - +} - - {{tab.label}} - {{tab.content}} - + @for (tab of asyncTabs | async; track tab) { + + {{tab.label}} + {{tab.content}} + + } diff --git a/src/components-examples/material/tabs/tab-group-async/tab-group-async-example.ts b/src/components-examples/material/tabs/tab-group-async/tab-group-async-example.ts index 1553ccb896d5..77392bddcb67 100644 --- a/src/components-examples/material/tabs/tab-group-async/tab-group-async-example.ts +++ b/src/components-examples/material/tabs/tab-group-async/tab-group-async-example.ts @@ -1,7 +1,7 @@ import {Component} from '@angular/core'; import {Observable, Observer} from 'rxjs'; import {MatTabsModule} from '@angular/material/tabs'; -import {NgIf, NgFor, AsyncPipe} from '@angular/common'; +import {AsyncPipe} from '@angular/common'; export interface ExampleTab { label: string; @@ -15,7 +15,7 @@ export interface ExampleTab { selector: 'tab-group-async-example', templateUrl: 'tab-group-async-example.html', standalone: true, - imports: [NgIf, MatTabsModule, NgFor, AsyncPipe], + imports: [MatTabsModule, AsyncPipe], }) export class TabGroupAsyncExample { asyncTabs: Observable; diff --git a/src/components-examples/material/tabs/tab-group-dynamic/tab-group-dynamic-example.html b/src/components-examples/material/tabs/tab-group-dynamic/tab-group-dynamic-example.html index a4f04d26946b..a50d28597e30 100644 --- a/src/components-examples/material/tabs/tab-group-dynamic/tab-group-dynamic-example.html +++ b/src/components-examples/material/tabs/tab-group-dynamic/tab-group-dynamic-example.html @@ -14,14 +14,16 @@ - - Contents for {{tab}} tab + @for (tab of tabs; track tab; let index = $index) { + + Contents for {{tab}} tab - - + + + } diff --git a/src/components-examples/material/tabs/tab-group-dynamic/tab-group-dynamic-example.ts b/src/components-examples/material/tabs/tab-group-dynamic/tab-group-dynamic-example.ts index b943f47fb7e2..a16bc9159558 100644 --- a/src/components-examples/material/tabs/tab-group-dynamic/tab-group-dynamic-example.ts +++ b/src/components-examples/material/tabs/tab-group-dynamic/tab-group-dynamic-example.ts @@ -1,6 +1,5 @@ import {Component} from '@angular/core'; import {FormControl, FormsModule, ReactiveFormsModule} from '@angular/forms'; -import {NgFor} from '@angular/common'; import {MatTabsModule} from '@angular/material/tabs'; import {MatCheckboxModule} from '@angular/material/checkbox'; import {MatButtonModule} from '@angular/material/button'; @@ -23,7 +22,6 @@ import {MatFormFieldModule} from '@angular/material/form-field'; MatButtonModule, MatCheckboxModule, MatTabsModule, - NgFor, ], }) export class TabGroupDynamicExample { diff --git a/src/components-examples/material/tabs/tab-group-paginated/tab-group-paginated-example.html b/src/components-examples/material/tabs/tab-group-paginated/tab-group-paginated-example.html index d6cf4166e8f6..fe8f6264d46c 100644 --- a/src/components-examples/material/tabs/tab-group-paginated/tab-group-paginated-example.html +++ b/src/components-examples/material/tabs/tab-group-paginated/tab-group-paginated-example.html @@ -1,3 +1,5 @@ - Content - \ No newline at end of file + @for (tab of lotsOfTabs; track tab) { + Content + } + diff --git a/src/components-examples/material/tabs/tab-group-paginated/tab-group-paginated-example.ts b/src/components-examples/material/tabs/tab-group-paginated/tab-group-paginated-example.ts index 00fc787758e9..48f86b5c6e77 100644 --- a/src/components-examples/material/tabs/tab-group-paginated/tab-group-paginated-example.ts +++ b/src/components-examples/material/tabs/tab-group-paginated/tab-group-paginated-example.ts @@ -1,5 +1,4 @@ import {Component} from '@angular/core'; -import {NgFor} from '@angular/common'; import {MatTabsModule} from '@angular/material/tabs'; /** @@ -9,7 +8,7 @@ import {MatTabsModule} from '@angular/material/tabs'; selector: 'tab-group-paginated-example', templateUrl: 'tab-group-paginated-example.html', standalone: true, - imports: [MatTabsModule, NgFor], + imports: [MatTabsModule], }) export class TabGroupPaginatedExample { lotsOfTabs = new Array(30).fill(0).map((_, index) => `Tab ${index}`); diff --git a/src/components-examples/material/tabs/tab-nav-bar-basic/tab-nav-bar-basic-example.html b/src/components-examples/material/tabs/tab-nav-bar-basic/tab-nav-bar-basic-example.html index ff20e1723701..b3f3d959cac8 100644 --- a/src/components-examples/material/tabs/tab-nav-bar-basic/tab-nav-bar-basic-example.html +++ b/src/components-examples/material/tabs/tab-nav-bar-basic/tab-nav-bar-basic-example.html @@ -1,8 +1,10 @@ diff --git a/src/components-examples/material/tabs/tab-nav-bar-basic/tab-nav-bar-basic-example.ts b/src/components-examples/material/tabs/tab-nav-bar-basic/tab-nav-bar-basic-example.ts index 3efbe1a2a184..244dcc462d89 100644 --- a/src/components-examples/material/tabs/tab-nav-bar-basic/tab-nav-bar-basic-example.ts +++ b/src/components-examples/material/tabs/tab-nav-bar-basic/tab-nav-bar-basic-example.ts @@ -1,7 +1,6 @@ import {Component} from '@angular/core'; import {ThemePalette} from '@angular/material/core'; import {MatButtonModule} from '@angular/material/button'; -import {NgFor} from '@angular/common'; import {MatTabsModule} from '@angular/material/tabs'; /** @@ -12,7 +11,7 @@ import {MatTabsModule} from '@angular/material/tabs'; templateUrl: 'tab-nav-bar-basic-example.html', styleUrls: ['tab-nav-bar-basic-example.css'], standalone: true, - imports: [MatTabsModule, NgFor, MatButtonModule], + imports: [MatTabsModule, MatButtonModule], }) export class TabNavBarBasicExample { links = ['First', 'Second', 'Third']; diff --git a/src/components-examples/material/tooltip/tooltip-auto-hide/tooltip-auto-hide-example.html b/src/components-examples/material/tooltip/tooltip-auto-hide/tooltip-auto-hide-example.html index 583f84211476..193542e1326c 100644 --- a/src/components-examples/material/tooltip/tooltip-auto-hide/tooltip-auto-hide-example.html +++ b/src/components-examples/material/tooltip/tooltip-auto-hide/tooltip-auto-hide-example.html @@ -1,9 +1,9 @@ Tooltip position - - {{positionOption}} - + @for (positionOption of positionOptions; track positionOption) { + {{positionOption}} + } diff --git a/src/components-examples/material/tooltip/tooltip-auto-hide/tooltip-auto-hide-example.ts b/src/components-examples/material/tooltip/tooltip-auto-hide/tooltip-auto-hide-example.ts index c850de5e80da..404d00b35c06 100644 --- a/src/components-examples/material/tooltip/tooltip-auto-hide/tooltip-auto-hide-example.ts +++ b/src/components-examples/material/tooltip/tooltip-auto-hide/tooltip-auto-hide-example.ts @@ -3,7 +3,6 @@ import {FormControl, FormsModule, ReactiveFormsModule} from '@angular/forms'; import {TooltipPosition, MatTooltipModule} from '@angular/material/tooltip'; import {MatButtonModule} from '@angular/material/button'; import {CdkScrollable} from '@angular/cdk/scrolling'; -import {NgFor} from '@angular/common'; import {MatSelectModule} from '@angular/material/select'; import {MatFormFieldModule} from '@angular/material/form-field'; @@ -20,7 +19,6 @@ import {MatFormFieldModule} from '@angular/material/form-field'; MatSelectModule, FormsModule, ReactiveFormsModule, - NgFor, CdkScrollable, MatButtonModule, MatTooltipModule, diff --git a/src/components-examples/material/tooltip/tooltip-position/tooltip-position-example.html b/src/components-examples/material/tooltip/tooltip-position/tooltip-position-example.html index 09459eb63cea..7c1c1d959729 100644 --- a/src/components-examples/material/tooltip/tooltip-position/tooltip-position-example.html +++ b/src/components-examples/material/tooltip/tooltip-position/tooltip-position-example.html @@ -1,9 +1,9 @@ Tooltip position - - {{positionOption}} - + @for (positionOption of positionOptions; track positionOption) { + {{positionOption}} + } diff --git a/src/components-examples/material/tooltip/tooltip-position/tooltip-position-example.ts b/src/components-examples/material/tooltip/tooltip-position/tooltip-position-example.ts index 9546f66a41da..f4d49df6a117 100644 --- a/src/components-examples/material/tooltip/tooltip-position/tooltip-position-example.ts +++ b/src/components-examples/material/tooltip/tooltip-position/tooltip-position-example.ts @@ -2,7 +2,6 @@ import {Component} from '@angular/core'; import {FormControl, FormsModule, ReactiveFormsModule} from '@angular/forms'; import {TooltipPosition, MatTooltipModule} from '@angular/material/tooltip'; import {MatButtonModule} from '@angular/material/button'; -import {NgFor} from '@angular/common'; import {MatSelectModule} from '@angular/material/select'; import {MatFormFieldModule} from '@angular/material/form-field'; @@ -19,7 +18,6 @@ import {MatFormFieldModule} from '@angular/material/form-field'; MatSelectModule, FormsModule, ReactiveFormsModule, - NgFor, MatButtonModule, MatTooltipModule, ], diff --git a/src/components-examples/material/tree/tree-dynamic/tree-dynamic-example.html b/src/components-examples/material/tree/tree-dynamic/tree-dynamic-example.html index 4fe64405b046..83b50b116e49 100644 --- a/src/components-examples/material/tree/tree-dynamic/tree-dynamic-example.html +++ b/src/components-examples/material/tree/tree-dynamic/tree-dynamic-example.html @@ -11,8 +11,10 @@ {{node.item}} - + @if (node.isLoading) { + + } diff --git a/src/components-examples/material/tree/tree-dynamic/tree-dynamic-example.ts b/src/components-examples/material/tree/tree-dynamic/tree-dynamic-example.ts index 53b74dc52add..c783ec46ce65 100644 --- a/src/components-examples/material/tree/tree-dynamic/tree-dynamic-example.ts +++ b/src/components-examples/material/tree/tree-dynamic/tree-dynamic-example.ts @@ -4,7 +4,6 @@ import {Component, Injectable} from '@angular/core'; import {BehaviorSubject, merge, Observable} from 'rxjs'; import {map} from 'rxjs/operators'; import {MatProgressBarModule} from '@angular/material/progress-bar'; -import {NgIf} from '@angular/common'; import {MatIconModule} from '@angular/material/icon'; import {MatButtonModule} from '@angular/material/button'; import {MatTreeModule} from '@angular/material/tree'; @@ -142,7 +141,7 @@ export class DynamicDataSource implements DataSource { templateUrl: 'tree-dynamic-example.html', styleUrls: ['tree-dynamic-example.css'], standalone: true, - imports: [MatTreeModule, MatButtonModule, MatIconModule, NgIf, MatProgressBarModule], + imports: [MatTreeModule, MatButtonModule, MatIconModule, MatProgressBarModule], }) export class TreeDynamicExample { constructor(database: DynamicDatabase) { diff --git a/src/dev-app/autocomplete/autocomplete-demo.html b/src/dev-app/autocomplete/autocomplete-demo.html index 6bbe1e9bec6c..9296652d082f 100644 --- a/src/dev-app/autocomplete/autocomplete-demo.html +++ b/src/dev-app/autocomplete/autocomplete-demo.html @@ -21,11 +21,12 @@ [hideSingleSelectionIndicator]="reactiveHideSingleSelectionIndicator" [autoActiveFirstOption]="reactiveAutoActiveFirstOption" [requireSelection]="reactiveRequireSelection"> - - {{ state.name }} - ({{ state.code }}) - + @for (state of reactiveStates; track state; let index = $index) { + + {{ state.name }} + ({{ state.code }}) + + }

    @@ -66,21 +67,25 @@

    Template-driven value (currentState): {{ currentState }}
    Template-driven dirty: {{ modelDir ? modelDir.dirty : false }}
    - - - State - - - - {{ state.name }} - - - + + @if (true) { + + State + + + @for (state of tdStates; track state) { + + {{ state.name }} + + } + + + }

    @@ -89,9 +94,9 @@ TOGGLE DISABLED

    @@ -141,8 +146,11 @@ - - {{ state.name }} - + @for (group of filteredGroupedStates; track group) { + + @for (state of group.states; track state) { + {{ state.name }} + } + + } diff --git a/src/dev-app/autocomplete/autocomplete-demo.ts b/src/dev-app/autocomplete/autocomplete-demo.ts index 08a9a9df027c..af551041dcde 100644 --- a/src/dev-app/autocomplete/autocomplete-demo.ts +++ b/src/dev-app/autocomplete/autocomplete-demo.ts @@ -224,9 +224,9 @@ export class AutocompleteDemo { T-Shirt Size - - {{size}} - + @for (size of sizes; track size) { + {{size}} + } diff --git a/src/dev-app/badge/badge-demo.html b/src/dev-app/badge/badge-demo.html index f25109539acf..9de265315fa1 100644 --- a/src/dev-app/badge/badge-demo.html +++ b/src/dev-app/badge/badge-demo.html @@ -54,9 +54,9 @@

    Size

    Text

    - - Hello - + @if (visible) { + Hello + } Hello diff --git a/src/dev-app/bottom-sheet/bottom-sheet-demo.html b/src/dev-app/bottom-sheet/bottom-sheet-demo.html index 7201ea582a44..e473b19169b9 100644 --- a/src/dev-app/bottom-sheet/bottom-sheet-demo.html +++ b/src/dev-app/bottom-sheet/bottom-sheet-demo.html @@ -36,10 +36,12 @@

    Options

    - - folder - Action {{ action }} - Description - + @for (action of [1, 2, 3]; track action) { + + folder + Action {{ action }} + Description + + } diff --git a/src/dev-app/bottom-sheet/bottom-sheet-demo.ts b/src/dev-app/bottom-sheet/bottom-sheet-demo.ts index 7e6b58a7d446..6f1e7fe52d97 100644 --- a/src/dev-app/bottom-sheet/bottom-sheet-demo.ts +++ b/src/dev-app/bottom-sheet/bottom-sheet-demo.ts @@ -70,10 +70,12 @@ export class BottomSheetDemo { @Component({ template: ` - - Action {{ action }} - Description - + @for (action of [1, 2, 3]; track action) { + + Action {{ action }} + Description + + } `, standalone: true, diff --git a/src/dev-app/button-toggle/button-toggle-demo.html b/src/dev-app/button-toggle/button-toggle-demo.html index a6db320b7973..b2cfc8186f3e 100644 --- a/src/dev-app/button-toggle/button-toggle-demo.html +++ b/src/dev-app/button-toggle/button-toggle-demo.html @@ -83,9 +83,9 @@

    Single Toggle

    Dynamic Exclusive Selection

    - - {{pie}} - + @for (pie of pieOptions; track pie) { + {{pie}} + }

    Your favorite type of pie is: {{favoritePie}}

    diff --git a/src/dev-app/cdk-menu/cdk-menu-demo.html b/src/dev-app/cdk-menu/cdk-menu-demo.html index ed790605b587..545b4ca0ce6e 100644 --- a/src/dev-app/cdk-menu/cdk-menu-demo.html +++ b/src/dev-app/cdk-menu/cdk-menu-demo.html @@ -145,48 +145,44 @@

    Radio items

    - + (cdkMenuItemTriggered)="selectedSize = size">{{size}} + }
    - + (cdkMenuItemTriggered)="selectedColor = color">{{color}} + }
    - + (cdkMenuItemTriggered)="selectedSize = size">{{size}} + }
    - + (cdkMenuItemTriggered)="selectedColor = color">{{color}} + }
    diff --git a/src/dev-app/checkbox/checkbox-demo.html b/src/dev-app/checkbox/checkbox-demo.html index ce19e105b890..8bd338ef7ae5 100644 --- a/src/dev-app/checkbox/checkbox-demo.html +++ b/src/dev-app/checkbox/checkbox-demo.html @@ -151,7 +151,9 @@
    Click action: check-indeterminate
    [indeterminate]="demoIndeterminate" (change)="demoChecked = $event.checked" (indeterminateChange)="demoIndeterminate = $event"> - Checkbox w/ [checked] & (change) + @if (!demoHideLabel) { + Checkbox w/ [checked] & (change) + } Click action: check-indeterminate [indeterminate]="demoIndeterminate" [(ngModel)]="demoChecked" (indeterminateChange)="demoIndeterminate = $event"> - Checkbox w/ [(ngModel)] + @if (!demoHideLabel) { + Checkbox w/ [(ngModel)] + }
    @@ -187,7 +191,9 @@
    Click action: check
    [indeterminate]="demoIndeterminate" (change)="demoChecked = $event.checked" (indeterminateChange)="demoIndeterminate = $event"> - Checkbox w/ [checked] & (change) + @if (!demoHideLabel) { + Checkbox w/ [checked] & (change) + } Click action: check [indeterminate]="demoIndeterminate" [(ngModel)]="demoChecked" (indeterminateChange)="demoIndeterminate = $event"> - Checkbox w/ [(ngModel)] + @if (!demoHideLabel) { + Checkbox w/ [(ngModel)] + }
    @@ -223,7 +231,9 @@
    Click action: noop
    [indeterminate]="demoIndeterminate" (change)="demoChecked = $event.checked" (indeterminateChange)="demoIndeterminate = $event"> - Checkbox w/ [checked] & (change) + @if (!demoHideLabel) { + Checkbox w/ [checked] & (change) + } Click action: noop [indeterminate]="demoIndeterminate" [(ngModel)]="demoChecked" (indeterminateChange)="demoIndeterminate = $event"> - Checkbox w/ [(ngModel)] + @if (!demoHideLabel) { + Checkbox w/ [(ngModel)] + }
    @@ -259,7 +271,9 @@
    No animations
    [indeterminate]="demoIndeterminate" (change)="demoChecked = $event.checked" (indeterminateChange)="demoIndeterminate = $event"> - Checkbox w/ [checked] & (change) + @if (!demoHideLabel) { + Checkbox w/ [checked] & (change) + } No animations [indeterminate]="demoIndeterminate" [(ngModel)]="demoChecked" (indeterminateChange)="demoIndeterminate = $event"> - Checkbox w/ [(ngModel)] + @if (!demoHideLabel) { + Checkbox w/ [(ngModel)] + }
    diff --git a/src/dev-app/checkbox/nested-checklist.html b/src/dev-app/checkbox/nested-checklist.html index 6a4ab3e617ab..7e41027b7fa7 100644 --- a/src/dev-app/checkbox/nested-checklist.html +++ b/src/dev-app/checkbox/nested-checklist.html @@ -1,18 +1,23 @@

    Tasks

      -
    • - -

      {{task.name}}

      -
      -
        -
      • - - {{subtask.name}} - -
      • -
      -
    • + @for (task of tasks; track task) { +
    • + +

      {{task.name}}

      +
      +
        + @for (subtask of task.subtasks; track subtask) { +
      • + + {{subtask.name}} + +
      • + } +
      +
    • + }
    diff --git a/src/dev-app/chips/chips-demo.html b/src/dev-app/chips/chips-demo.html index 894a2a2c60b1..60b2ded6ec09 100644 --- a/src/dev-app/chips/chips-demo.html +++ b/src/dev-app/chips/chips-demo.html @@ -95,13 +95,15 @@

    With avatar, icons, and color

    With Events

    - - With Events - - + @if (visible) { + + With Events + + + }
    {{message}}
    @@ -122,19 +124,27 @@

    With Events

    Single selection

    - - {{shirtSize.label}} - {{shirtSize.avatar}} - + @for (shirtSize of shirtSizes; track shirtSize) { + + {{shirtSize.label}} + @if (listboxesWithAvatar) { + {{shirtSize.avatar}} + } + + }

    Multi selection

    - - {{hint.avatar}} - {{hint.label}} - + @for (hint of restaurantHints; track hint) { + + @if (listboxesWithAvatar) { + {{hint.avatar}} + } + {{hint.label}} + + } @@ -163,15 +173,17 @@

    Input is last child of chip grid

    New Contributor... - - {{person.name}} - - + @for (person of people; track person) { + + {{person.name}} + + + } Input is next sibling child of chip grid New Contributor... - - {{person.name}} - - + @for (person of people; track person) { + + {{person.name}} + + + } Stacked

    - - {{aColor.name}} - + @for (aColor of availableColors; track aColor) { + {{aColor.name}} + }

    NgModel with multi selection

    - - {{aColor.name}} - + @for (aColor of availableColors; track aColor) { + {{aColor.name}} + } The selected colors are - - {{color}}{{isLast ? '' : ', '}}. + @for (color of selectedColors; track color; let isLast = $last) { + {{color}}{{isLast ? '' : ', '}} + }

    NgModel with single selection

    - - {{aColor.name}} - + @for (aColor of availableColors; track aColor) { + {{aColor.name}} + } The selected color is {{selectedColor}}. @@ -254,21 +266,22 @@

    NgModel with single selection

    Single selection without checkmark selection indicator.

    - - {{aColor.name}} - + @for (aColor of availableColors; track aColor) { + {{aColor.name}} + }

    Single selection with decorative icons.

    - - home - {{aColor.name}} - star - + @for (aColor of availableColors; track aColor) { + + home + {{aColor.name}} + star + + } The selected color is {{selectedColor}}. @@ -276,11 +289,13 @@

    Single selection with decorative icons.

    Single selection with stacked appearance.

    - - {{aColor.name}} - star - + @for (aColor of availableColors; track aColor) { + + {{aColor.name}} + star + + } The selected color is {{selectedColor}}. diff --git a/src/dev-app/connected-overlay/connected-overlay-demo.html b/src/dev-app/connected-overlay/connected-overlay-demo.html index c0d6bee6f8f6..ebdcea4a2014 100644 --- a/src/dev-app/connected-overlay/connected-overlay-demo.html +++ b/src/dev-app/connected-overlay/connected-overlay-demo.html @@ -111,7 +111,11 @@

    Options

    -
    • {{itemText}} {{i}}
    +
      + @for (item of itemArray; track item; let i = $index) { +
    • {{itemText}} {{i}}
    • + } +
    diff --git a/src/dev-app/datepicker/datepicker-demo.html b/src/dev-app/datepicker/datepicker-demo.html index ccbb216015fe..f2132816a6c5 100644 --- a/src/dev-app/datepicker/datepicker-demo.html +++ b/src/dev-app/datepicker/datepicker-demo.html @@ -21,10 +21,12 @@

    Options

    [disabled]="inputDisabled" [max]="maxDate"> - - - - + @if (showActions) { + + + + + }
    @@ -33,10 +35,12 @@

    Options

    [disabled]="inputDisabled" [min]="minDate"> - - - - + @if (showActions) { + + + + + }

    @@ -47,10 +51,12 @@

    Options

    [disabled]="inputDisabled"> - - - - + @if (showActions) { + + + + + }

    @@ -78,17 +84,27 @@

    Result

    [startAt]="startAt" [startView]="yearView ? 'year' : 'month'" [color]="color"> - - - - + @if (showActions) { + + + + + } - - "{{resultPickerModel.getError('matDatepickerParse').text}}" is not a valid date! - - Too early! - Too late! - Date unavailable! + @if (resultPickerModel.hasError('matDatepickerParse')) { + + "{{resultPickerModel.getError('matDatepickerParse').text}}" is not a valid date! + + } + @if (resultPickerModel.hasError('matDatepickerMin')) { + Too early! + } + @if (resultPickerModel.hasError('matDatepickerMax')) { + Too late! + } + @if (resultPickerModel.hasError('matDatepickerFilter')) { + Date unavailable! + }

    Last input: {{lastDateInput}}

    @@ -110,10 +126,12 @@

    Result

    [disabled]="datepickerDisabled" [startAt]="startAt" [startView]="yearView ? 'year' : 'month'"> - - - - + @if (showActions) { + + + + + }

    @@ -217,10 +235,12 @@

    Range picker

    [disabled]="datepickerDisabled" [color]="color" #range1Picker> - - - - + @if (showActions) { + + + + + }
    {{range1.value | json}}
    @@ -247,10 +267,12 @@

    Range picker

    [disabled]="datepickerDisabled" panelClass="demo-custom-range" #range2Picker> - - - - + @if (showActions) { + + + + + }
    {{range2.value | json}}
    @@ -276,10 +298,12 @@

    Range picker

    [touchUi]="touch" [disabled]="datepickerDisabled" #range3Picker> - - - - + @if (showActions) { + + + + + }
    {{range3.value | json}}
    @@ -296,10 +320,12 @@

    Range picker with custom selection strategy

    - - - - + @if (showActions) { + + + + + } diff --git a/src/dev-app/dev-app/dev-app-layout.html b/src/dev-app/dev-app/dev-app-layout.html index b4b7829c0142..56eb8f7a8fa9 100644 --- a/src/dev-app/dev-app/dev-app-layout.html +++ b/src/dev-app/dev-app/dev-app-layout.html @@ -1,15 +1,15 @@ - - {{navItem.name}} - + @for (navItem of navItems; track navItem) { + {{navItem.name}} + } diff --git a/src/dev-app/drag-drop/drag-drop-demo.html b/src/dev-app/drag-drop/drag-drop-demo.html index 035c0125592e..5c011e0a1042 100644 --- a/src/dev-app/drag-drop/drag-drop-demo.html +++ b/src/dev-app/drag-drop/drag-drop-demo.html @@ -5,12 +5,13 @@

    To do

    cdkDropList (cdkDropListDropped)="drop($event)" [cdkDropListLockAxis]="axisLock" - [cdkDropListData]="todo" - > -
    - {{item}} - -
    + [cdkDropListData]="todo"> + @for (item of todo; track item) { +
    + {{item}} + +
    + } @@ -20,12 +21,13 @@

    Done

    cdkDropList (cdkDropListDropped)="drop($event)" [cdkDropListLockAxis]="axisLock" - [cdkDropListData]="done" - > -
    - {{item}} - -
    + [cdkDropListData]="done"> + @for (item of done; track item) { +
    + {{item}} + +
    + } @@ -38,12 +40,13 @@

    Ages

    cdkDropListOrientation="horizontal" (cdkDropListDropped)="drop($event)" [cdkDropListLockAxis]="axisLock" - [cdkDropListData]="ages" - > -
    - {{item}} - -
    + [cdkDropListData]="ages"> + @for (item of ages; track item) { +
    + {{item}} + +
    + } @@ -54,12 +57,13 @@

    Preferred Ages

    cdkDropListOrientation="horizontal" (cdkDropListDropped)="drop($event)" [cdkDropListLockAxis]="axisLock" - [cdkDropListData]="preferredAges" - > -
    - {{item}} - -
    + [cdkDropListData]="preferredAges"> + @for (item of preferredAges; track item) { +
    + {{item}} + +
    + } diff --git a/src/dev-app/example/example-list.ts b/src/dev-app/example/example-list.ts index e7b6d5aa0c67..99b0363efea4 100644 --- a/src/dev-app/example/example-list.ts +++ b/src/dev-app/example/example-list.ts @@ -20,18 +20,20 @@ import {Example} from './example'; imports: [CommonModule, MatExpansionModule, Example], template: ` - - -
    -
    {{_getTitle(id)}}
    -
    <{{id}}>
    -
    -
    + @for (id of ids; track id) { + + +
    +
    {{_getTitle(id)}}
    +
    <{{id}}>
    +
    +
    - - - -
    + + + +
    + }
    `, styles: [ diff --git a/src/dev-app/example/example.ts b/src/dev-app/example/example.ts index 3a1be014cb8f..6bef62e47864 100644 --- a/src/dev-app/example/example.ts +++ b/src/dev-app/example/example.ts @@ -24,14 +24,18 @@ import { standalone: true, imports: [CommonModule], template: ` -
    - {{title}} - <{{id}}> -
    + @if (showLabel) { +
    + {{title}} + <{{id}}> +
    + } -
    - Could not find example {{id}} -
    + @if (!id) { +
    + Could not find example {{id}} +
    + } `, styles: [ ` diff --git a/src/dev-app/expansion/expansion-demo.html b/src/dev-app/expansion/expansion-demo.html index 98b14ca6ada2..8a93eed0ea06 100644 --- a/src/dev-app/expansion/expansion-demo.html +++ b/src/dev-app/expansion/expansion-demo.html @@ -33,7 +33,9 @@

    Single Expansion Panel

    Expansion Panel Animation Events

    -
    {{event}}
    + @for (event of events; track event) { +
    {{event}}
    + }

    matAccordion

    @@ -78,14 +80,18 @@

    matAccordion

    Section 2

    This is the content text that makes sense here.

    - - Section 3 - Reveal Buttons Below - - - - - + @if (showPanel3) { + + Section 3 + Reveal Buttons Below + @if (showButtons.checked) { + + + + + } + + }

    cdkAccordion

    @@ -102,7 +108,9 @@

    cdkAccordion

    -

    I only show if item 1 is expanded

    + @if (item1.expanded) { +

    I only show if item 1 is expanded

    + }

    @@ -110,7 +118,9 @@

    cdkAccordion

    -

    I only show if item 2 is expanded

    + @if (item2.expanded) { +

    I only show if item 2 is expanded

    + }

    @@ -118,7 +128,9 @@

    cdkAccordion

    -

    I only show if item 3 is expanded

    + @if (item3.expanded) { +

    I only show if item 3 is expanded

    + }
    diff --git a/src/dev-app/focus-trap/focus-trap-demo.html b/src/dev-app/focus-trap/focus-trap-demo.html index b4f488d6c79c..6a84b7a10728 100644 --- a/src/dev-app/focus-trap/focus-trap-demo.html +++ b/src/dev-app/focus-trap/focus-trap-demo.html @@ -65,8 +65,8 @@ Shadow DOMs - - + + @if (_supportsShadowDom) { @@ -83,9 +83,10 @@ - - Shadow DOM not supported - + } @else { + Shadow DOM not supported + } + diff --git a/src/dev-app/google-map/google-map-demo.html b/src/dev-app/google-map/google-map-demo.html index 9bb8317d2ab6..610b1141132f 100644 --- a/src/dev-app/google-map/google-map-demo.html +++ b/src/dev-app/google-map/google-map-demo.html @@ -1,174 +1,198 @@ -
    Loading Google Maps API...
    -
    - - - - - - Testing 1 2 3 - - - - - - - - - - - - - - -

    {{display?.lat}}

    -

    {{display?.lng}}

    - -
    - -
    - -
    - -
    -
    - -
    - -
    - -
    -
    - -
    - -
    - -
    -
    - -
    - -
    - -
    -
    - -
    - -
    - -
    - -
    - -
    - -
    - -
    - -
    - -
    - -
    - -
    - -
    - -
    - -
    - -
    - -
    - -
    - -
    +@if (hasLoaded) { +
    + + + + @for (markerPosition of markerPositions; track markerPosition) { + + } + + Testing 1 2 3 + @if (isPolylineDisplayed) { + + } + @if (isPolygonDisplayed) { + + } + @if (isRectangleDisplayed) { + + } + @if (isCircleDisplayed) { + + } + @if (isGroundOverlayDisplayed) { + + } + @if (isKmlLayerDisplayed) { + + } + @if (isTrafficLayerDisplayed) { + + } + @if (isTransitLayerDisplayed) { + + } + @if (isBicyclingLayerDisplayed) { + + } + @if (directionsResult) { + + } + @if (isHeatmapDisplayed) { + + } + + +

    {{display?.lat}}

    +

    {{display?.lng}}

    + +
    + +
    + +
    + +
    +
    + +
    + +
    + +
    +
    + +
    + +
    + +
    +
    + +
    + +
    + +
    +
    + +
    + +
    + +
    + +
    + +
    + +
    + +
    + +
    + +
    + +
    + +
    + +
    + +
    + +
    + +
    + +
    + +
    +
    +} @else { +
    Loading Google Maps API...
    +} diff --git a/src/dev-app/grid-list/grid-list-demo.html b/src/dev-app/grid-list/grid-list-demo.html index 10d526cf00c2..f467ea7f6a01 100644 --- a/src/dev-app/grid-list/grid-list-demo.html +++ b/src/dev-app/grid-list/grid-list-demo.html @@ -55,10 +55,12 @@ Fixed-height grid list - - {{tile.text}} - + @for (tile of tiles; track tile) { + + {{tile.text}} + + } @@ -72,9 +74,9 @@ Ratio-height grid list - - {{tile.text}} - + @for (tile of tiles; track tile) { + {{tile.text}} + } @@ -87,9 +89,9 @@ - - {{tile.text}} - + @for (tile of tiles; track tile) { + {{tile.text}} + } @@ -102,12 +104,14 @@ Grid list with header - - - info_outline - {{dog.name}} - - + @for (dog of dogs; track dog) { + + + info_outline + {{dog.name}} + + + }
    @@ -116,14 +120,16 @@ Grid list with footer - - - -

    {{dog.name}}

    - Human: {{dog.human}} - star_border -
    -
    + @for (dog of dogs; track dog) { + + + +

    {{dog.name}}

    + Human: {{dog.human}} + star_border +
    +
    + }
    diff --git a/src/dev-app/input/input-demo.html b/src/dev-app/input/input-demo.html index b7b9f5344700..0742fa5c891e 100644 --- a/src/dev-app/input/input-demo.html +++ b/src/dev-app/input/input-demo.html @@ -73,12 +73,12 @@

    Regular

    Email - - This field is required - - - Please enter a valid email address - + @if (emailFormControl.hasError('required')) { + This field is required + } + @if (emailFormControl.hasError('pattern')) { + Please enter a valid email address + }

    @@ -124,7 +124,9 @@

    Text

    Amount - $ + @if (showPrefix) { + $ + } .00 @@ -140,7 +142,9 @@

    Icons

    Amount - calendar_today + @if (showPrefix) { + calendar_today + } mode_edit @@ -148,9 +152,11 @@

    Icon buttons

    Amount - + @if (showPrefix) { + + } @@ -162,9 +168,11 @@

    Text & Icons

    $ .00 - + @if (showPrefix) { + + } @@ -491,21 +499,23 @@

    Textarea

    - - {{i+1}} - - - Value - - - - - - - {{item.value}} - + @for (item of items; track item; let i = $index) { + + {{i+1}} + + + Value + + + + + + + {{item.value}} + + } @@ -730,7 +740,9 @@

    <textarea> with bindable autosize

    - {{option}} + @for (option of options; track option) { + {{option}} + }

    @@ -741,7 +753,9 @@

    <textarea> with bindable autosize

    - {{option}} + @for (option of options; track option) { + {{option}} + }

    @@ -776,7 +790,9 @@

    <textarea> with bindable autosize

    Amount - + @if (showSecondPrefix) { + + } .00 diff --git a/src/dev-app/list/list-demo.html b/src/dev-app/list/list-demo.html index 2be72e3bbba6..5edc6cdfa7d0 100644 --- a/src/dev-app/list/list-demo.html +++ b/src/dev-app/list/list-demo.html @@ -11,45 +11,57 @@

    Normal lists

    Items
    - - {{item}} - + @for (item of items; track item) { + {{item}} + }
    - -
    {{contact.name}}
    -
    extra line
    -
    {{contact.headline}}
    -
    + @for (contact of contacts; track contact) { + +
    {{contact.name}}
    + @if (thirdLine) { +
    extra line
    + } +
    {{contact.headline}}
    +
    + }
    Today
    - - Image of {{message.from}} -
    {{message.from}}
    -
    - {{message.subject}} -- - {{message.message}} -
    - -
    + @for (message of messages; track message) { + + Image of {{message.from}} +
    {{message.from}}
    +
    + {{message.subject}} -- + {{message.message}} +
    + @if (!$last) { + + } +
    + } - -
    {{message.from}}
    -
    {{message.subject}}
    -
    {{message.message}}
    -
    + @for (message of messages; track message) { + +
    {{message.from}}
    +
    {{message.subject}}
    +
    {{message.message}}
    +
    + }
    - - {{ link.name }} - - + @for (link of links; track link) { + + {{ link.name }} + + + } @@ -57,61 +69,71 @@

    Normal lists

    Dense lists

    Items
    - - {{item}} - + @for (item of items; track item) { + {{item}} + }
    - -
    {{contact.name}}
    -
    {{contact.headline}}
    -
    + @for (contact of contacts; track contact) { + +
    {{contact.name}}
    +
    {{contact.headline}}
    +
    + }
    Today
    - - Image of {{message.from}} -
    {{message.from}}
    -
    {{message.subject}}
    -
    {{message.message}}
    -
    + @for (message of messages; track message) { + + Image of {{message.from}} +
    {{message.from}}
    +
    {{message.subject}}
    +
    {{message.message}}
    +
    + }
    - - {{ link.name }} - - + @for (link of links; track link) { + + {{ link.name }} + + + }

    Nav lists

    - - {{ link.name }} - + @for (link of links; track link) { + + {{ link.name }} + + } -
    - More info! -
    + @if (infoClicked) { +
    More info!
    + } - - folder - {{ link.name }} - + @for (link of links; track link; let last = $last) { + + folder + {{ link.name }} + + }

    Action list

    - + @for (link of links; track link) { + + }
    @@ -228,10 +250,12 @@

    Line scenarios

    Line alignment

    - - {{ link.name }} - Unscoped content - + @for (link of links; track link) { + + {{ link.name }} + Unscoped content + + } diff --git a/src/dev-app/menu/menu-demo.html b/src/dev-app/menu/menu-demo.html index 7638e8012d0e..69338bb190e8 100644 --- a/src/dev-app/menu/menu-demo.html +++ b/src/dev-app/menu/menu-demo.html @@ -9,9 +9,11 @@ - + @for (item of items; track item) { + + }
    @@ -24,12 +26,12 @@ - - - - + @for (item of items; track item) { + + @if (!$last) { + + } + }
    @@ -95,9 +97,11 @@ - - {{ item.text }} - + @for (item of items; track item) { + + {{ item.text }} + + }
    @@ -111,10 +115,12 @@ - + @for (item of iconItems; track item) { + + }
    @@ -128,9 +134,9 @@ - + @for (item of items; track item) { + + }
    @@ -146,9 +152,9 @@ - + @for (item of items; track item) { + + }
    @@ -162,10 +168,12 @@ - + @for (item of iconItems; track item) { + + }
    @@ -179,9 +187,9 @@ - + @for (item of items; track item) { + + }
    diff --git a/src/dev-app/performance/performance-demo.html b/src/dev-app/performance/performance-demo.html index 73466ba93973..2cfd68c5f975 100644 --- a/src/dev-app/performance/performance-demo.html +++ b/src/dev-app/performance/performance-demo.html @@ -36,10 +36,14 @@ No. {{ item.index }} - + @if (allSamples.length) { + Average render time - - No data yet + +} + @if (!allSamples.length) { + No data yet +} @@ -65,26 +69,32 @@ > +@if (allSamples.length) { +} - - +@if (show) { + + @for (_ of componentArray; track _) { + Input - - + +} + +} diff --git a/src/dev-app/performance/performance-demo.ts b/src/dev-app/performance/performance-demo.ts index 7e0b17bc4b68..612c2dda3dd6 100644 --- a/src/dev-app/performance/performance-demo.ts +++ b/src/dev-app/performance/performance-demo.ts @@ -64,7 +64,7 @@ export class PerformanceDemo implements AfterViewInit { /** The average plus/minus the stdev. */ computedResults = ''; - /** Used in an ngFor to render the desired number of comonents. */ + /** Used in an `@for` to render the desired number of comonents. */ componentArray = [].constructor(this.componentCount); /** The standard deviation of the recorded samples. */ diff --git a/src/dev-app/platform/platform-demo.html b/src/dev-app/platform/platform-demo.html index 79397500200e..012cfba294d4 100644 --- a/src/dev-app/platform/platform-demo.html +++ b/src/dev-app/platform/platform-demo.html @@ -9,5 +9,7 @@

    Supported input types: - {{type}}, + @for (type of supportedInputTypes; track type) { + {{type}}, + }

    diff --git a/src/dev-app/portal/portal-demo.html b/src/dev-app/portal/portal-demo.html index bdb0e648447c..e6aaefc7b2c8 100644 --- a/src/dev-app/portal/portal-demo.html +++ b/src/dev-app/portal/portal-demo.html @@ -21,7 +21,7 @@

    The portal outlet is here:

    diff --git a/src/dev-app/radio/radio-demo.html b/src/dev-app/radio/radio-demo.html index 2c11becb2327..35a4def520db 100644 --- a/src/dev-app/radio/radio-demo.html +++ b/src/dev-app/radio/radio-demo.html @@ -55,9 +55,11 @@

    Favorite Season Example

    Dynamic Example with two-way data-binding

    - - {{season}} - + @for (season of seasonOptions; track season) { + + {{season}} + + }

    Your favorite season is: {{favoriteSeason}}

    diff --git a/src/dev-app/select/select-demo.html b/src/dev-app/select/select-demo.html index 5eee7a9ee2ce..190d3ed68ff7 100644 --- a/src/dev-app/select/select-demo.html +++ b/src/dev-app/select/select-demo.html @@ -13,10 +13,12 @@ None - - {{ drink.viewValue }} - + @for (drink of drinks; track drink; let index = $index) { + + {{ drink.viewValue }} + + } local_drink Pick a drink! @@ -44,9 +46,9 @@

    @@ -73,9 +75,11 @@ Pokemon - - {{ creature.viewValue }} - + @for (creature of pokemon; track creature) { + + {{ creature.viewValue }} + + }

    Value: {{ currentPokemon }}

    @@ -85,7 +89,9 @@

    @@ -104,9 +110,9 @@ Digimon None - - {{ creature.viewValue }} - + @for (creature of digimon; track creature) { + {{ creature.viewValue }} + } @@ -124,12 +130,13 @@ Pokemon - - - {{ creature.viewValue }} - - + @for (group of pokemonGroups; track group) { + + @for (creature of group.pokemon; track creature) { + {{ creature.viewValue }} + } + + } @@ -145,9 +152,9 @@ [required]="drinkObjectRequired" [compareWith]="compareByValue ? compareDrinkObjectsByValue : compareByReference" #drinkObjectControl="ngModel"> - - {{ drink.viewValue }} - + @for (drink of drinks; track drink) { + {{ drink.viewValue }} + }

    Value: {{ currentDrinkObject | json }}

    @@ -174,9 +181,9 @@ Fill None - - {{ creature.viewValue }} - + @for (creature of digimon; track creature) { + {{ creature.viewValue }} + }

    @@ -186,9 +193,9 @@ Outline None - - {{ creature.viewValue }} - + @for (creature of digimon; track creature) { + {{ creature.viewValue }} + }

    @@ -197,45 +204,52 @@ -
    - - formControl + @if (showSelect) { +
    + + formControl - - - Food I would like to eat - - {{ food.viewValue }} - - -

    Value: {{ foodControl.value }}

    -

    Touched: {{ foodControl.touched }}

    -

    Dirty: {{ foodControl.dirty }}

    -

    Status: {{ foodControl.status }}

    - - - -
    -
    -
    + + + Food I would like to eat + + @for (food of foods; track food) { + {{ food.viewValue }} + } + + +

    Value: {{ foodControl.value }}

    +

    Touched: {{ foodControl.touched }}

    +

    Dirty: {{ foodControl.dirty }}

    +

    Status: {{ foodControl.status }}

    + + + +
    +
    +
    + } -
    - - Change event + @if (showSelect) { +
    + + Change event - - - Starter pokemon - - {{ creature.viewValue }} - - - -

    Change event value: {{ latestChangeEvent?.value }}

    -
    -
    -
    + + + Starter pokemon + + @for (creature of pokemon; track creature) { + {{ creature.viewValue }} + } + + +

    Change event value: {{ latestChangeEvent?.value }}

    +
    +
    +
    + } @@ -342,9 +356,9 @@

    Error message, hint, form sumbit

    - - This field is required - + @if (selectFormControl.hasError('required')) { + This field is required + } You can pick up your favorite car here @@ -357,9 +371,9 @@

    Error message with errorStateMatcher

    - - This field is required - + @if (selectFormControl.hasError('required')) { + This field is required + } You can pick up your favorite car here @@ -375,27 +389,27 @@

    Error message with errorStateMatcher

    Bread - - {{ bread.viewValue }} - + @for (bread of breads; track bread) { + {{ bread.viewValue }} + } Meat - - {{ meat.viewValue }} - + @for (meat of meats; track meat) { + {{ meat.viewValue }} + } Cheese - - {{ cheese.viewValue }} - + @for (cheese of cheeses; track cheese) { + {{ cheese.viewValue }} + }

    @@ -403,4 +417,4 @@

    Error message with errorStateMatcher

    Hide Single-Selection Indicator -
    \ No newline at end of file + diff --git a/src/dev-app/sidenav/sidenav-demo.html b/src/dev-app/sidenav/sidenav-demo.html index 7df77ef46f58..f7d461e9b827 100644 --- a/src/dev-app/sidenav/sidenav-demo.html +++ b/src/dev-app/sidenav/sidenav-demo.html @@ -1,9 +1,8 @@ - - -
    - Header +@if (isLaunched) { +
    + @if (showHeader && !coverHeader) { + Header + } @@ -17,7 +16,9 @@
    Mode: {{start.mode}}

    -
    Filler Content
    + @for (c of fillerContent; track c) { +
    Filler Content
    + }
    -
    Filler Content
    + @for (c of fillerContent; track c) { +
    Filler Content
    + }
    - Header + @if (showHeader && coverHeader) { + Header + }
    -
    Filler Content
    + @for (c of fillerContent; track c) { +
    Filler Content
    + }
    - Footer + @if (showFooter && coverHeader) { + Footer + }
    - Footer + @if (showFooter && !coverHeader) { + Footer + }
    +} @else { + +} diff --git a/src/dev-app/snack-bar/snack-bar-demo.html b/src/dev-app/snack-bar/snack-bar-demo.html index 080876020a1c..26d54831feb0 100644 --- a/src/dev-app/snack-bar/snack-bar-demo.html +++ b/src/dev-app/snack-bar/snack-bar-demo.html @@ -25,24 +25,30 @@

    SnackBar demo

    -

    Show button on snack bar

    - - Snack bar action label - - + @if (action) { + + Snack bar action label + + + } @else { +

    Show button on snack bar

    + }
    -

    Auto hide after duration

    - - Auto hide duration in ms - - + @if (setAutoHide) { + + Auto hide duration in ms + + + } @else { +

    Auto hide after duration

    + }

    diff --git a/src/dev-app/stepper/stepper-demo.html b/src/dev-app/stepper/stepper-demo.html index 9b6004bb2d8d..1dd2a5e94cda 100644 --- a/src/dev-app/stepper/stepper-demo.html +++ b/src/dev-app/stepper/stepper-demo.html @@ -16,7 +16,9 @@ Theme - {{theme.name}} + @for (theme of availableThemes; track theme) { + {{theme.name}} + }

    @@ -231,17 +233,19 @@

    Horizontal Stepper Demo with Text Label

    Horizontal Stepper Demo with Templated Label

    - - {{step.label}} - - Answer - - -
    - - -
    -
    + @for (step of steps; track step) { + + {{step.label}} + + Answer + + +
    + + +
    +
    + }

    Stepper with autosize textarea

    diff --git a/src/dev-app/table-scroll-container/table-scroll-container-demo.html b/src/dev-app/table-scroll-container/table-scroll-container-demo.html index 21aa8b40398d..69229922693e 100644 --- a/src/dev-app/table-scroll-container/table-scroll-container-demo.html +++ b/src/dev-app/table-scroll-container/table-scroll-container-demo.html @@ -35,46 +35,46 @@ -
    - - - - - - +@for (table of tables; track table) { +
    +
    Position {{element.position}} Position Footer
    + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - + + - + - - -
    Position {{element.position}} Position Footer Name {{element.name}} Name Footer Name {{element.name}} Name Footer Weight {{element.weight}} Weight Footer Weight {{element.weight}} Weight Footer Symbol {{element.symbol}} Symbol Footer Symbol {{element.symbol}} Symbol Footer Filler header cell Filler data cell Filler footer cell Filler header cell Filler data cell Filler footer cell
    -
    + + + + +} diff --git a/src/dev-app/youtube-player/youtube-player-demo.html b/src/dev-app/youtube-player/youtube-player-demo.html index a7ff2eb4c615..5a8a04f8c6c2 100644 --- a/src/dev-app/youtube-player/youtube-player-demo.html +++ b/src/dev-app/youtube-player/youtube-player-demo.html @@ -4,9 +4,9 @@

    Basic Example

    - - {{video.name}} - + @for (video of videos; track video) { + {{video.name}} + } Unset
    diff --git a/src/e2e-app/components/e2e-app/e2e-app.html b/src/e2e-app/components/e2e-app/e2e-app.html index d948ef73a18f..7bfa37644fa5 100644 --- a/src/e2e-app/components/e2e-app/e2e-app.html +++ b/src/e2e-app/components/e2e-app/e2e-app.html @@ -1,9 +1,13 @@
    - - {{link.title}} - + @if (showLinks) { + + @for (link of navLinks; track link) { + {{link.title}} + } + + }
    diff --git a/src/google-maps/README.md b/src/google-maps/README.md index 8cc09375b663..acea33991e30 100644 --- a/src/google-maps/README.md +++ b/src/google-maps/README.md @@ -59,7 +59,7 @@ export class GoogleMapsDemoComponent { apiLoaded: Observable; constructor(httpClient: HttpClient) { - // If you're using the `` directive, you also have to include the `visualization` library + // If you're using the `` directive, you also have to include the `visualization` library // when loading the Google Maps API. To do so, you can add `&libraries=visualization` to the script URL: // https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&libraries=visualization @@ -75,9 +75,9 @@ export class GoogleMapsDemoComponent { ```html -
    +@if (apiLoaded | async) { -
    +} ``` ## Components diff --git a/src/google-maps/map-directions-renderer/README.md b/src/google-maps/map-directions-renderer/README.md index d40c54678c31..f0e705d4dd51 100644 --- a/src/google-maps/map-directions-renderer/README.md +++ b/src/google-maps/map-directions-renderer/README.md @@ -51,7 +51,8 @@ export class GoogleMapDemo { width="750px" [center]="center" [zoom]="zoom"> - + @if (directionsResults$ | async; as directionsResults) { + + } ``` diff --git a/src/google-maps/map-info-window/README.md b/src/google-maps/map-info-window/README.md index 4b60ab0ebfdb..046553258ab2 100644 --- a/src/google-maps/map-info-window/README.md +++ b/src/google-maps/map-info-window/README.md @@ -39,10 +39,12 @@ export class GoogleMapDemo { [center]="center" [zoom]="zoom" (mapClick)="addMarker($event)"> - + + @for (position of markerPositions; track position) { + + } Info Window content ``` diff --git a/src/google-maps/map-marker-clusterer/README.md b/src/google-maps/map-marker-clusterer/README.md index 4b73cc8d6a77..1ca18feb31b4 100644 --- a/src/google-maps/map-marker-clusterer/README.md +++ b/src/google-maps/map-marker-clusterer/README.md @@ -43,8 +43,9 @@ export class GoogleMapDemo { [zoom]="zoom" (mapClick)="addMarker($event)"> - + @for (position of markerPositions; track position) { + + } ``` diff --git a/src/google-maps/map-marker-clusterer/map-marker-clusterer.spec.ts b/src/google-maps/map-marker-clusterer/map-marker-clusterer.spec.ts index c4a5e475ee91..ed08e42e22b6 100644 --- a/src/google-maps/map-marker-clusterer/map-marker-clusterer.spec.ts +++ b/src/google-maps/map-marker-clusterer/map-marker-clusterer.spec.ts @@ -325,9 +325,15 @@ describe('MapMarkerClusterer', () => { [options]="options" (clusteringbegin)="onClusteringBegin()" (clusterClick)="onClusterClick()"> - - - + @if (state === 'state1') { + + } + @if (state === 'state1' || state === 'state2') { + + } + @if (state === 'state2') { + + } `, }) diff --git a/src/google-maps/map-marker/README.md b/src/google-maps/map-marker/README.md index 2089aebd9f2d..2360943b2940 100644 --- a/src/google-maps/map-marker/README.md +++ b/src/google-maps/map-marker/README.md @@ -32,8 +32,8 @@ export class GoogleMapDemo { [center]="center" [zoom]="zoom" (mapClick)="addMarker($event)"> - + @for (position of markerPositions; track position) { + + } ``` diff --git a/src/material/autocomplete/autocomplete.md b/src/material/autocomplete/autocomplete.md index 48fdcd9070e4..6bb167e3b029 100644 --- a/src/material/autocomplete/autocomplete.md +++ b/src/material/autocomplete/autocomplete.md @@ -111,7 +111,9 @@ autocomplete is attached to using the `matAutocompleteOrigin` directive together - {{option}} + @for (option of options; track option) { + {{option}} + } ``` diff --git a/src/material/autocomplete/autocomplete.spec.ts b/src/material/autocomplete/autocomplete.spec.ts index 801d808702bd..4723e194cac9 100644 --- a/src/material/autocomplete/autocomplete.spec.ts +++ b/src/material/autocomplete/autocomplete.spec.ts @@ -3758,7 +3758,9 @@ describe('MDC-based MatAutocomplete', () => { const SIMPLE_AUTOCOMPLETE_TEMPLATE = ` - State + @if (hasLabel) { + State + } - - {{ state.code }}: {{ state.name }} - + @for (state of filteredStates; track state) { + + {{ state.code }}: {{ state.name }} + + } `; @@ -3848,14 +3851,18 @@ class SimpleAutocompleteShadowDom extends SimpleAutocomplete {} @Component({ template: ` - + @if (isVisible) { + +} - + @for (option of filteredOptions | async; track option) { + {{option}} +} `, }) @@ -3888,9 +3895,11 @@ class NgIfAutocomplete { - - {{ state }} - + @for (state of filteredStates; track state) { + + {{ state }} + + } `, }) @@ -3915,9 +3924,11 @@ class AutocompleteWithoutForms { - - {{ state }} - + @for (state of filteredStates; track state) { + + {{ state }} + + } `, }) @@ -3944,9 +3955,11 @@ class AutocompleteWithNgModel { - - {{ number }} - + @for (number of numbers; track number) { + + {{ number }} + + } `, }) @@ -3963,7 +3976,9 @@ class AutocompleteWithNumbers { - {{ option }} + @for (option of options; track option) { + {{ option }} + } `, }) @@ -3983,9 +3998,9 @@ class AutocompleteWithOnPushDelay implements OnInit { - - {{option}} - + @for (option of filteredOptions | async; track option) { + {{option}} + } `, }) @@ -4024,11 +4039,15 @@ class AutocompleteWithoutPanel { - - - {{ state }} - - + @for (group of stateGroups; track group) { + + @for (state of group.states; track state) { + + {{ state }} + + } + + } `, }) @@ -4058,13 +4077,17 @@ class AutocompleteWithGroups { - - - - {{ state }} - - - + @if (true) { + @for (group of stateGroups; track group) { + + @for (state of group.states; track state) { + + {{ state }} + + } + + } + } `, }) @@ -4077,9 +4100,11 @@ class AutocompleteWithIndirectGroups extends AutocompleteWithGroups {} - - {{ state }} - + @for (state of states; track state) { + + {{ state }} + + } `, }) @@ -4109,7 +4134,9 @@ class PlainAutocompleteInputWithFormControl { - {{value}} + @for (value of values; track value) { + {{value}} + } `, }) @@ -4139,7 +4166,9 @@ class AutocompleteWithNumberInputAndNgModel { - {{value}} + @for (value of values; track value) { + {{value}} + } `, }) @@ -4173,7 +4202,9 @@ class InputWithoutAutocompleteAndDisabled {} - {{ state }} + @for (state of states; track state) { + {{ state }} + } `, }) @@ -4198,9 +4229,9 @@ class AutocompleteWithActivatedEvent { - - {{food.viewValue}} - + @for (food of foods; track food; let index = $index) { + {{food.viewValue}} + }
    diff --git a/src/material/autocomplete/testing/autocomplete-harness.spec.ts b/src/material/autocomplete/testing/autocomplete-harness.spec.ts index 0c4350e3f371..2948d774bfb8 100644 --- a/src/material/autocomplete/testing/autocomplete-harness.spec.ts +++ b/src/material/autocomplete/testing/autocomplete-harness.spec.ts @@ -156,15 +156,19 @@ describe('MatAutocompleteHarness', () => { @Component({ template: ` - {{ state.name }} + @for (state of states; track state) { + {{ state.name }} + } - - {{ state.name }} - + @for (group of stateGroups; track group) { + + @for (state of group.states; track state) { + {{ state.name }} + } + + } diff --git a/src/material/button-toggle/button-toggle.spec.ts b/src/material/button-toggle/button-toggle.spec.ts index 9b38f86d4669..4217167225bb 100644 --- a/src/material/button-toggle/button-toggle.spec.ts +++ b/src/material/button-toggle/button-toggle.spec.ts @@ -962,7 +962,9 @@ describe('MatButtonToggle without forms', () => { - Test1 + @if (renderFirstToggle) { + Test1 + } Test2 Test3 @@ -981,12 +983,12 @@ class ButtonTogglesInsideButtonToggleGroup { [name]="groupName" [(ngModel)]="modelValue" (change)="lastEvent = $event"> - - {{option.label}} - + @for (option of options; track option) { + {{option.label}} + } `, }) @@ -1064,14 +1066,14 @@ class ButtonToggleGroupWithFormControl { } @Component({ - // We need the `ngSwitch` so that there's a directive between the group and the toggles. + // We need the `@if` so that there's a container between the group and the toggles. template: ` - + @if (true) { Value Red Value Green Value Blue - + } `, }) @@ -1094,9 +1096,9 @@ class ButtonToggleWithAriaLabelledby {} @Component({ template: ` - - {{toggle}} - + @for (toggle of possibleValues; track toggle) { + {{toggle}} + } `, }) @@ -1141,7 +1143,9 @@ class ButtonToggleWithStaticAriaAttributes {} @Component({ template: ` - {{value}} + @for (value of values; track value) { + {{value}} + } `, }) diff --git a/src/material/chips/chip-grid.spec.ts b/src/material/chips/chip-grid.spec.ts index 946f017e8122..77790253d94c 100644 --- a/src/material/chips/chip-grid.spec.ts +++ b/src/material/chips/chip-grid.spec.ts @@ -1033,10 +1033,12 @@ describe('MDC-based MatChipGrid', () => { @Component({ template: ` - {{name}} {{i + 1}} +} `, }) @@ -1053,7 +1055,9 @@ class StandardChipGrid { Add a chip - {{chip}} + @for (chip of chips; track chip) { + {{chip}} +} @@ -1076,9 +1080,11 @@ class FormFieldChipGrid { New food... - + @for (food of foods; track food) { + {{ food.viewValue }} +} - + @for (food of foods; track food) { + {{food.viewValue}} +} Please select a chip, or type to add a new chip @@ -1162,7 +1170,9 @@ class ChipGridWithFormErrorMessages { @Component({ template: ` - {{i}} + @for (i of numbers; track i) { + {{i}} +} `, animations: [ @@ -1189,10 +1199,12 @@ class StandardChipGridWithAnimations { template: ` - + @for (i of chips; track i) { + Chip {{i + 1}} Remove +} diff --git a/src/material/chips/chip-listbox.spec.ts b/src/material/chips/chip-listbox.spec.ts index ac964fa2cbda..cd4024edef6a 100644 --- a/src/material/chips/chip-listbox.spec.ts +++ b/src/material/chips/chip-listbox.spec.ts @@ -870,10 +870,11 @@ describe('MDC-based MatChipListbox', () => { @Component({ template: ` - - {{name}} {{i + 1}} - + @for (i of chips; track i) { + + {{name}} {{i + 1}} + + } `, }) class StandardChipListbox { @@ -890,9 +891,11 @@ class StandardChipListbox { template: ` - - {{ food.viewValue }} - + @for (food of foods; track food) { + + {{ food.viewValue }} + + } `, }) @@ -921,9 +924,11 @@ class BasicChipListbox { - - {{ food.viewValue }} - + @for (food of foods; track food) { + + {{ food.viewValue }} + + } `, }) @@ -950,9 +955,9 @@ class MultiSelectionChipListbox { @Component({ template: ` - - {{ food.viewValue }} - + @for (food of foods; track food) { + {{ food.viewValue }} + } `, }) @@ -968,9 +973,11 @@ class FalsyValueChipListbox { @Component({ template: ` - + @for (food of foods; track food) { + {{ food.viewValue }} + } `, }) @@ -987,9 +994,11 @@ class SelectedChipListbox { template: ` - - {{ food.viewValue }} - + @for (food of foods; track food) { + + {{ food.viewValue }} + + } `, }) diff --git a/src/material/chips/chip-option.spec.ts b/src/material/chips/chip-option.spec.ts index 1897d290ac0f..cc74d3011c32 100644 --- a/src/material/chips/chip-option.spec.ts +++ b/src/material/chips/chip-option.spec.ts @@ -398,16 +398,20 @@ describe('MDC-based Option Chips', () => { @Component({ template: ` -
    - - {{avatarLabel}} - {{name}} - -
    + @if (shouldShow) { +
    + + @if (avatarLabel) { + {{avatarLabel}} + } + {{name}} + +
    + }
    `, }) class SingleChip { diff --git a/src/material/chips/chip-row.spec.ts b/src/material/chips/chip-row.spec.ts index c6c44ee47d5e..695fa085a836 100644 --- a/src/material/chips/chip-row.spec.ts +++ b/src/material/chips/chip-row.spec.ts @@ -384,18 +384,22 @@ describe('MDC-based Row Chips', () => { @Component({ template: ` -
    - - {{name}} - - - - -
    + @if (shouldShow) { +
    + + {{name}} + + @if (useCustomEditInput) { + + } + + +
    + }
    `, }) class SingleChip { diff --git a/src/material/chips/chip-set.spec.ts b/src/material/chips/chip-set.spec.ts index a5e6363d034b..89c4fdb2fd7c 100644 --- a/src/material/chips/chip-set.spec.ts +++ b/src/material/chips/chip-set.spec.ts @@ -109,9 +109,9 @@ describe('MDC-based MatChipSet', () => { @Component({ template: ` - - {{name}} {{i + 1}} - + @for (i of chips; track i) { + {{name}} {{i + 1}} + } `, }) @@ -123,11 +123,11 @@ class BasicChipSet { @Component({ template: ` - - - {{name}} {{i + 1}} - - + @if (true) { + @for (i of chips; track i) { + {{name}} {{i + 1}} + } + } `, }) diff --git a/src/material/chips/chip.spec.ts b/src/material/chips/chip.spec.ts index a5f828a20e61..cb15b4935eb6 100644 --- a/src/material/chips/chip.spec.ts +++ b/src/material/chips/chip.spec.ts @@ -185,14 +185,16 @@ describe('MDC-based MatChip', () => { @Component({ template: ` -
    - - {{name}} - -
    + @if (shouldShow) { +
    + + {{name}} + +
    + }
    `, }) class SingleChip { diff --git a/src/material/chips/chips.md b/src/material/chips/chips.md index 8a95c6cb4fbc..f803ff2910ae 100644 --- a/src/material/chips/chips.md +++ b/src/material/chips/chips.md @@ -94,7 +94,7 @@ See the [accessibility](#accessibility) section for best practices on implementi ### Orientation -By default, chips are displayed horizontally. To stack chips vertically, apply the `mat-mdc-chip-set-stacked` class to ``, `` or ``. +By default, chips are displayed horizontally. To stack chips vertically, apply the `mat-mdc-chip-set-stacked` class to ``, `` or ``. @@ -141,14 +141,15 @@ The chips components support 3 user interaction patterns, each with its own cont ```html - - {{filling.name}} - - + aria-label="enter sandwich fillings"> + @for (filling of fillings; track filling) { + + {{filling.name}} + + + } diff --git a/src/material/chips/testing/chip-listbox-harness.spec.ts b/src/material/chips/testing/chip-listbox-harness.spec.ts index 1843d50a08c8..d513a7c03c42 100644 --- a/src/material/chips/testing/chip-listbox-harness.spec.ts +++ b/src/material/chips/testing/chip-listbox-harness.spec.ts @@ -112,9 +112,11 @@ describe('MatChipListboxHarness', () => { @Component({ template: ` - - {{option.text}} - + @for (option of options; track option) { + + {{option.text}} + + } `, }) diff --git a/src/material/core/ripple/ripple.spec.ts b/src/material/core/ripple/ripple.spec.ts index a38158cc68b4..cc3ef2a61d99 100644 --- a/src/material/core/ripple/ripple.spec.ts +++ b/src/material/core/ripple/ripple.spec.ts @@ -874,7 +874,7 @@ class RippleContainerWithInputBindings { class RippleContainerWithoutBindings {} @Component({ - template: `
    `, + template: `@if (!isDestroyed) {
    }`, }) class RippleContainerWithNgIf { @ViewChild(MatRipple) ripple: MatRipple; @@ -897,9 +897,9 @@ class RippleCssTransitionDurationZero {} @Component({ template: ` -
    - Click to remove this element. -
    + @if (show) { +
    Click to remove this element.
    + } `, }) class RippleWithDomRemovalOnClick { diff --git a/src/material/datepicker/datepicker-actions.spec.ts b/src/material/datepicker/datepicker-actions.spec.ts index e4fd8fb34104..6a004e161330 100644 --- a/src/material/datepicker/datepicker-actions.spec.ts +++ b/src/material/datepicker/datepicker-actions.spec.ts @@ -292,10 +292,12 @@ describe('MatDatepickerActions', () => { [formControl]="control" (dateChange)="onDateChange()"> - - - - + @if (renderActions) { + + + + + }
    `, diff --git a/src/material/dialog/dialog.spec.ts b/src/material/dialog/dialog.spec.ts index a43f9dc70940..e8be88bc3231 100644 --- a/src/material/dialog/dialog.spec.ts +++ b/src/material/dialog/dialog.spec.ts @@ -2121,7 +2121,7 @@ class ComponentWithOnPushViewContainer { @Component({ selector: 'arbitrary-component', - template: ``, + template: `@if (showChildView) {}`, }) class ComponentWithChildViewContainer { showChildView = true; @@ -2162,9 +2162,15 @@ class PizzaMsg { @Component({ template: ` -

    This is the first title

    -

    This is the second title

    -

    This is the third title

    + @if (shouldShowTitle('first')) { +

    This is the first title

    + } + @if (shouldShowTitle('second')) { +

    This is the second title

    + } + @if (shouldShowTitle('third')) { +

    This is the third title

    + } Lorem ipsum dolor sit amet. @@ -2189,9 +2195,15 @@ class ContentElementDialog { @Component({ template: ` -

    This is the first title

    -

    This is the second title

    -

    This is the third title

    + @if (shouldShowTitle('first')) { +

    This is the first title

    + } + @if (shouldShowTitle('second')) { +

    This is the second title

    + } + @if (shouldShowTitle('third')) { +

    This is the third title

    + } Lorem ipsum dolor sit amet. @@ -2238,7 +2250,10 @@ class ShadowDomComponent {} @Component({template: ''}) class ModuleBoundDialogParentComponent { - constructor(private _injector: Injector, private _dialog: MatDialog) {} + constructor( + private _injector: Injector, + private _dialog: MatDialog, + ) {} openDialog(): void { const ngModuleRef = createNgModuleRef( diff --git a/src/material/divider/divider.md b/src/material/divider/divider.md index 960ef674945d..6e0094184c3b 100644 --- a/src/material/divider/divider.md +++ b/src/material/divider/divider.md @@ -38,19 +38,25 @@ in a list, because it will overlap with the section divider. ```html

    Folders

    - - folder -

    {{folder.name}}

    -

    {{folder.updated}}

    - -
    + @for (folder of folders; track folder) { + + folder +

    {{folder.name}}

    +

    {{folder.updated}}

    + @if (!$last) { + + } +
    + }

    Notes

    - - note -

    {{note.name}}

    -

    {{note.updated}}

    -
    + @for (note of notes; track node) { + + note +

    {{note.name}}

    +

    {{note.updated}}

    +
    + }
    ``` diff --git a/src/material/expansion/accordion.spec.ts b/src/material/expansion/accordion.spec.ts index 45d441c6f469..e0de275e23ce 100644 --- a/src/material/expansion/accordion.spec.ts +++ b/src/material/expansion/accordion.spec.ts @@ -303,10 +303,12 @@ describe('MatAccordion', () => { @Component({ template: ` - - Summary {{i}} -

    Content

    -
    + @for (i of [0, 1, 2, 3]; track i) { + + Summary {{i}} +

    Content

    +
    + }
    `, }) class SetOfItems { diff --git a/src/material/expansion/expansion.spec.ts b/src/material/expansion/expansion.spec.ts index ae3fbc004a2c..f79a19e1e965 100644 --- a/src/material/expansion/expansion.spec.ts +++ b/src/material/expansion/expansion.spec.ts @@ -582,11 +582,14 @@ class PanelWithContent { @Component({ template: ` -
    - - Panel Title - -
    `, + @if (expansionShown) { +
    + + Panel Title + +
    + } + `, }) class PanelWithContentInNgIf { expansionShown = true; diff --git a/src/material/form-field/form-field.md b/src/material/form-field/form-field.md index 5ccf3129b13b..a393f128eb24 100644 --- a/src/material/form-field/form-field.md +++ b/src/material/form-field/form-field.md @@ -86,7 +86,7 @@ has interacted with the element or the parent form has been submitted. Since the same space as the hints, the hints are hidden when the errors are shown. If a form field can have more than one error state, it is up to the consumer to toggle which -messages should be displayed. This can be done with CSS, `ngIf` or `ngSwitch`. Multiple error +messages should be displayed. This can be done with CSS, `@if` or `@switch`. Multiple error messages can be shown at the same time if desired, but the `` only reserves enough space to display one error message at a time. Ensuring that enough space is available to display multiple errors is up to the user. diff --git a/src/material/grid-list/grid-list.spec.ts b/src/material/grid-list/grid-list.spec.ts index f6519917c11f..ceca04053d5b 100644 --- a/src/material/grid-list/grid-list.spec.ts +++ b/src/material/grid-list/grid-list.spec.ts @@ -676,10 +676,12 @@ class GridListWithRowspanBinding { template: `
    - - {{tile.text}} - + @for (tile of tiles; track tile) { + + {{tile.text}} + + }
    `, }) @@ -744,10 +746,10 @@ class GridListWithFooterContainingTwoLines {} - + @if (true) {

    First line

    Second line -
    + }
    `, @@ -779,13 +781,13 @@ class GridListWithEmptyDirectionality {} class GridListWithRtl {} @Component({ - // Note the blank `ngSwitch` which we need in order to hit the bug that we're testing. + // Note the blank `@if` which we need in order to hit the bug that we're testing. template: `
    - + @if (true) { - + }
    `, diff --git a/src/material/grid-list/testing/grid-list-harness.spec.ts b/src/material/grid-list/testing/grid-list-harness.spec.ts index 2faf72ab5986..2431235d850e 100644 --- a/src/material/grid-list/testing/grid-list-harness.spec.ts +++ b/src/material/grid-list/testing/grid-list-harness.spec.ts @@ -151,7 +151,9 @@ describe('MatGridListHarness', () => { {{firstTileText}} - Footer + @if (showFooter) { + Footer + } Two diff --git a/src/material/icon/icon.spec.ts b/src/material/icon/icon.spec.ts index 3d7e8f18d2c3..2a02df303cf9 100644 --- a/src/material/icon/icon.spec.ts +++ b/src/material/icon/icon.spec.ts @@ -1420,7 +1420,7 @@ class IconFromSvgName { @Component({template: 'face'}) class IconWithAriaHiddenFalse {} -@Component({template: `{{iconName}}`}) +@Component({template: `@if (showIcon) {{{iconName}}}`}) class IconWithBindingAndNgIf { iconName = 'fluffy'; showIcon = true; diff --git a/src/material/input/input.spec.ts b/src/material/input/input.spec.ts index 0f805aae8033..fef22dd52f7c 100644 --- a/src/material/input/input.spec.ts +++ b/src/material/input/input.spec.ts @@ -1629,7 +1629,9 @@ class MatInputHintLabelTestController { template: ` - Some error + @if (showError) { + Some error + } `, }) class MatInputWithSubscriptAndAriaDescribedBy { @@ -1782,7 +1784,9 @@ class MatInputMissingMatInputTestController {} Please type something - This field is required + @if (renderError) { + This field is required + } `, @@ -1855,7 +1859,9 @@ class MatInputWithPrefixAndSuffix {} @Component({ template: ` - + @if (renderInput) { + + } `, }) diff --git a/src/material/list/list.md b/src/material/list/list.md index 9360406bc586..c1c86b453b30 100644 --- a/src/material/list/list.md +++ b/src/material/list/list.md @@ -62,7 +62,9 @@ Simple navigation lists can use the `mat-list-item` attribute on anchor tag elem ```html - {{ link }} + @for (link of list; track link) { + {{ link }} + } ``` @@ -71,12 +73,14 @@ element in an ``. ```html - - {{ link }} - - + @for (link of links; track link) { + + {{ link }} + + + } ``` @@ -111,22 +115,26 @@ attribute. Whichever heading tag is appropriate for your DOM hierarchy should be ```html - -

    {{message.from}}

    -

    - {{message.subject}} - -- {{message.content}} -

    -
    + @for (message of messages; track message) { + +

    {{message.from}}

    +

    + {{message.subject}} + -- {{message.content}} +

    +
    + }
    - -

    {{message.from}}

    -

    {{message.subject}}

    -

    {{message.content}}

    -
    + @for (message of messages; track message) { + +

    {{message.from}}

    +

    {{message.subject}}

    +

    {{message.content}}

    +
    + }
    ``` @@ -137,14 +145,16 @@ To add an icon to your list item, use the `matListItemIcon` attribute. ```html - - folder -

    {{message.from}}

    -

    - {{message.subject}} - -- {{message.content}} -

    -
    + @for (message of messages; track message) { + + folder +

    {{message.from}}

    +

    + {{message.subject}} + -- {{message.content}} +

    +
    + }
    ``` @@ -154,14 +164,16 @@ To include an avatar image, add an image tag with an `matListItemAvatar` attribu ```html - - ... -

    {{message.from}}

    -

    - {{message.subject}} - -- {{message.content}} -

    -
    + @for (message of messages; track message) { + + ... +

    {{message.from}}

    +

    + {{message.subject}} + -- {{message.content}} +

    +
    + }
    ``` @@ -173,18 +185,22 @@ To add a divider, use ``. ```html

    Folders

    - - folder -

    {{folder.name}}

    -

    {{folder.updated}}

    -
    + @for (folder of folders; track folder) { + + folder +

    {{folder.name}}

    +

    {{folder.updated}}

    +
    + }

    Notes

    - - note -

    {{note.name}}

    -

    {{note.updated}}

    -
    + @for (note of notes; track note) { + + note +

    {{note.name}}

    +

    {{note.updated}}

    +
    + }
    ``` diff --git a/src/material/list/list.spec.ts b/src/material/list/list.spec.ts index 5b97fc9f1460..53214f0a75d5 100644 --- a/src/material/list/list.spec.ts +++ b/src/material/list/list.spec.ts @@ -449,10 +449,12 @@ class NavListWithOneAnchorItem extends BaseTestList { @Component({ template: ` - - {{item.name}} - + @for (item of items; track item; let index = $index) { + + {{item.name}} + + } `, }) class NavListWithActivatedItem extends BaseTestList { @@ -493,9 +495,9 @@ class ActionListWithType extends BaseTestList { @Component({ template: ` - + @for (item of items; track item) { + + } `, }) class ActionListWithDisabledList extends BaseTestList { @@ -528,11 +530,13 @@ class ListWithOneItem extends BaseTestList {} @Component({ template: ` - - -

    {{item.name}}

    -

    {{item.description}}

    -
    + @for (item of items; track item) { + + +

    {{item.name}}

    +

    {{item.description}}

    +
    + }
    `, }) class ListWithTwoLineItem extends BaseTestList {} @@ -540,11 +544,13 @@ class ListWithTwoLineItem extends BaseTestList {} @Component({ template: ` - -

    {{item.name}}

    -

    {{item.description}}

    -

    Some other text

    -
    + @for (item of items; track item) { + +

    {{item.name}}

    +

    {{item.description}}

    +

    Some other text

    +
    + }
    `, }) class ListWithThreeLineItem extends BaseTestList {} @@ -552,12 +558,14 @@ class ListWithThreeLineItem extends BaseTestList {} @Component({ template: ` - -

    Line 1

    -

    Line 2

    -

    Line 3

    -

    Line 4

    -
    + @for (item of items; track item) { + +

    Line 1

    +

    Line 2

    +

    Line 3

    +

    Line 4

    +
    + }
    `, }) class ListWithManyLines extends BaseTestList {} @@ -579,10 +587,12 @@ class ListWithAvatar extends BaseTestList {} @Component({ template: ` - -

    {{item.name}}

    -

    {{item.description}}

    -
    + @for (item of items; track item) { + +

    {{item.name}}

    +

    {{item.description}}

    +
    + }
    `, }) class ListWithItemWithCssClass extends BaseTestList {} @@ -590,11 +600,15 @@ class ListWithItemWithCssClass extends BaseTestList {} @Component({ template: ` - -

    {{item.name}}

    -

    {{item.description}}

    -

    Some other text

    -
    + @for (item of items; track item) { + +

    {{item.name}}

    +

    {{item.description}}

    + @if (showThirdLine) { +

    Some other text

    + } +
    + }
    `, }) class ListWithDynamicNumberOfLines extends BaseTestList {} @@ -602,9 +616,9 @@ class ListWithDynamicNumberOfLines extends BaseTestList {} @Component({ template: ` - - {{item.name}} - + @for (item of items; track item) { + {{item.name}} + } `, }) class ListWithMultipleItems extends BaseTestList {} diff --git a/src/material/list/selection-list.spec.ts b/src/material/list/selection-list.spec.ts index c908b52a24f6..51ec5b0413d0 100644 --- a/src/material/list/selection-list.spec.ts +++ b/src/material/list/selection-list.spec.ts @@ -1725,9 +1725,11 @@ describe('MDC-based MatSelectionList with forms', () => { Archive - - Drafts - + @if (showLastOption) { + + Drafts + + }
    `, }) class SelectionListWithListOptions { @@ -1837,7 +1839,9 @@ class SelectionListWithOnlyOneOption {} [(ngModel)]="selectedOptions" (ngModelChange)="modelChangeSpy()" [multiple]="multiple"> - {{option}} + @for (option of options; track option) { + {{option}} + } `, }) class SelectionListWithModel { @@ -1849,12 +1853,16 @@ class SelectionListWithModel { @Component({ template: ` - - Option 1 - Option 2 - Option 3 - Option 4 - + @if (renderList) { + + Option 1 + Option 2 + Option 3 + @if (renderExtraOption) { + Option 4 + } + + } `, }) class SelectionListWithFormControl { @@ -1889,7 +1897,9 @@ class SelectionListWithPreselectedOptionAndModel { changeDetection: ChangeDetectionStrategy.OnPush, template: ` - {{opt}} + @for (opt of opts; track opt) { + {{opt}} + } `, }) @@ -1901,9 +1911,9 @@ class SelectionListWithPreselectedFormControlOnPush { @Component({ template: ` - - {{option.label}} - + @for (option of options; track option) { + {{option.label}} + } `, }) class SelectionListWithCustomComparator { @@ -1946,13 +1956,13 @@ class SelectionListWithIcon { } @Component({ - // Note the blank `ngSwitch` which we need in order to hit the bug that we're testing. + // Note the blank `@if` which we need in order to hit the bug that we're testing. template: ` - + @if (true) { One Two - + } `, }) class SelectionListWithIndirectChildOptions { diff --git a/src/material/menu/menu.spec.ts b/src/material/menu/menu.spec.ts index 8af757362780..5722baf4819b 100644 --- a/src/material/menu/menu.spec.ts +++ b/src/material/menu/menu.spec.ts @@ -2780,7 +2780,9 @@ const SIMPLE_MENU_TEMPLATE = ` - + @for (item of extraItems; track item) { + + } `; @@ -2889,11 +2891,12 @@ class CustomMenu { [matMenuTriggerFor]="levelOne" #levelOneTrigger="matMenuTrigger">One - + @if (showLazy) { + + } @@ -2962,11 +2965,12 @@ class NestedMenuCustomElevation { template: ` - + @for (item of items; track item) { + + } @@ -3083,10 +3087,9 @@ class MenuWithCheckboxItems { template: ` - + @for (item of items; track item) { + + } `, }) @@ -3105,10 +3108,9 @@ class SimpleMenuWithRepeater { - + @for (item of items; track item) { + + } `, @@ -3173,7 +3175,9 @@ class StaticAriaDescribedbyMenu {} template: ` - + @for (item of items; track item) { + + } `, }) diff --git a/src/material/progress-spinner/progress-spinner.spec.ts b/src/material/progress-spinner/progress-spinner.spec.ts index c17934f8c29b..6b93ca5d7f5f 100644 --- a/src/material/progress-spinner/progress-spinner.spec.ts +++ b/src/material/progress-spinner/progress-spinner.spec.ts @@ -462,9 +462,11 @@ class IndeterminateSpinnerInShadowDom { @Component({ template: ` -
    - -
    + @if (true) { +
    + +
    + } `, encapsulation: ViewEncapsulation.ShadowDom, }) diff --git a/src/material/radio/radio.spec.ts b/src/material/radio/radio.spec.ts index 1e32fc0f1cad..31c5ebed27b1 100644 --- a/src/material/radio/radio.spec.ts +++ b/src/material/radio/radio.spec.ts @@ -1007,10 +1007,12 @@ describe('MatRadioDefaultOverrides', () => { [required]="isGroupRequired" [value]="groupValue" name="test-name"> - - Charmander - + @if (isFirstShown) { + + Charmander + + } Squirtle @@ -1073,9 +1075,9 @@ class StandaloneRadioButtons { @Component({ template: ` - - {{option.label}} - + @for (option of options; track option) { + {{option.label}} + } `, }) @@ -1125,9 +1127,11 @@ class FocusableRadioButton { @Component({ template: ` - - {{option.label}} - + @for (option of options; track option) { + + {{option.label}} + + } `, }) @@ -1176,15 +1180,16 @@ class RadioButtonWithPredefinedAriaAttributes {} // Note that this is somewhat of a contrived template, but it is required to // reproduce the issue. It was taken for a specific user report at #25831. template: ` - + @if (true) { - - + } - + @if (true) { + + } `, }) diff --git a/src/material/radio/testing/radio-harness.spec.ts b/src/material/radio/testing/radio-harness.spec.ts index fc933aa27787..ad19f356e1e2 100644 --- a/src/material/radio/testing/radio-harness.spec.ts +++ b/src/material/radio/testing/radio-harness.spec.ts @@ -185,18 +185,16 @@ describe('radio harness', () => { }); it('should get label text', async () => { - const [firstRadio, secondRadio, thirdRadio] = await loader.getAllHarnesses( - MatRadioButtonHarness, - ); + const [firstRadio, secondRadio, thirdRadio] = + await loader.getAllHarnesses(MatRadioButtonHarness); expect(await firstRadio.getLabelText()).toBe('Option #1'); expect(await secondRadio.getLabelText()).toBe('Option #2'); expect(await thirdRadio.getLabelText()).toBe('Option #3'); }); it('should get value', async () => { - const [firstRadio, secondRadio, thirdRadio] = await loader.getAllHarnesses( - MatRadioButtonHarness, - ); + const [firstRadio, secondRadio, thirdRadio] = + await loader.getAllHarnesses(MatRadioButtonHarness); expect(await firstRadio.getValue()).toBe('opt1'); expect(await secondRadio.getValue()).toBe('opt2'); expect(await thirdRadio.getValue()).toBe('opt3'); @@ -264,23 +262,25 @@ describe('radio harness', () => { @Component({ template: ` - - Option #{{i + 1}} - + @for (value of values; track value) { + + Option #{{$index + 1}} + + } - - {{value}} - + @for (value of values; track value) { + {{value}} + } diff --git a/src/material/select/select.md b/src/material/select/select.md index a26aab612e28..6169c15faec9 100644 --- a/src/material/select/select.md +++ b/src/material/select/select.md @@ -176,15 +176,18 @@ items. This error is thrown if you attempt to bind the `multiple` property on `` to a dynamic value. (e.g. `[multiple]="isMultiple"` where the value of `isMultiple` changes over the course of -the component's lifetime). If you need to change this dynamically, use `ngIf` or `ngSwitch` instead: +the component's lifetime). If you need to change this dynamically, use `@if` or `@switch` instead: ```html - - ... - - - ... - +@if (isMultiple) { + + ... + +} @else { + + ... + +} ``` #### Error: Value must be an array in multiple-selection mode diff --git a/src/material/select/select.spec.ts b/src/material/select/select.spec.ts index 87fe1e9ae4d8..27f32fc633f8 100644 --- a/src/material/select/select.spec.ts +++ b/src/material/select/select.spec.ts @@ -4575,18 +4575,24 @@ describe('MDC-based MatSelect', () => { template: `
    - Select a food + @if (hasLabel) { + Select a food + } - - {{ capitalize ? food.viewValue.toUpperCase() : food.viewValue }} - + @for (food of foods; track food) { + + {{ capitalize ? food.viewValue.toUpperCase() : food.viewValue }} + + } - {{ hint }} + @if (hint) { + {{ hint }} + }
    `, @@ -4627,9 +4633,9 @@ class BasicSelect { template: ` - {{ food.viewValue }} - + @for (food of foods; track food) { + {{ food.viewValue }} + } `, @@ -4668,15 +4674,17 @@ class ManySelects {} @Component({ selector: 'ng-if-select', template: ` -
    - - - - {{ food.viewValue }} - - - -
    + @if (isShowing) { +
    + + + @for (food of foods; track food) { + {{ food.viewValue }} + } + + +
    + } `, }) class NgIfSelect { @@ -4696,7 +4704,9 @@ class NgIfSelect { template: ` - {{ food }} + @for (food of foods; track food) { + {{ food }} + } `, @@ -4721,9 +4731,9 @@ class SelectWithChangeEvent { template: ` - - {{ food.viewValue }} - + @for (food of foods; track food) { + {{ food.viewValue }} + } `, @@ -4808,9 +4818,9 @@ class ThrowsErrorOnInit implements OnInit { template: ` - - {{ food.viewValue }} - + @for (food of foods; track food) { + {{ food.viewValue }} + } `, @@ -4830,9 +4840,9 @@ class BasicSelectOnPush { template: ` - - {{ food.viewValue }} - + @for (food of foods; track food) { + {{ food.viewValue }} + } `, @@ -4853,9 +4863,9 @@ class BasicSelectOnPushPreselected { Select a food - - {{ food.viewValue }} - + @for (food of foods; track food) { + {{ food.viewValue }} + } `, @@ -4879,9 +4889,9 @@ class FloatLabelSelect { - {{ food.viewValue }} - + @for (food of foods; track food) { + {{ food.viewValue }} + } `, @@ -4916,7 +4926,9 @@ class SelectWithPlainTabindex {} -
    + @if (select.selected) { +
    + } `, }) class SelectEarlyAccessSibling {} @@ -4969,9 +4981,9 @@ class BasicSelectWithTheming { Select a food - - {{ food.viewValue }} - + @for (food of foods; track food) { + {{ food.viewValue }} + } None @@ -4995,9 +5007,9 @@ class ResetValuesSelect { template: ` - {{ food.viewValue }} - + @for (food of foods; track food) { + {{ food.viewValue }} + } `, @@ -5016,12 +5028,13 @@ class FalsyValueSelect { template: ` - - - {{ pokemon.viewValue }} - - + @for (group of pokemonTypes; track group) { + + @for (pokemon of group.pokemon; track pokemon) { + {{ pokemon.viewValue }} + } + + } Mr. Mime @@ -5073,11 +5086,13 @@ class SelectWithGroups { template: ` - - - {{ pokemon.viewValue }} - - + @for (group of pokemonTypes; track group) { + + @for (pokemon of group.pokemon; track pokemon) { + {{ pokemon.viewValue }} + } + + } `, @@ -5111,9 +5126,9 @@ class InvalidSelectInForm { Food - - {{option.viewValue}} - + @for (option of options; track option) { + {{option.viewValue}} + } This field is required @@ -5138,9 +5153,9 @@ class SelectInsideFormGroup { template: ` - - {{ food.viewValue }} - + @for (food of foods; track food) { + {{ food.viewValue }} + } `, @@ -5160,9 +5175,9 @@ class BasicSelectWithoutForms { template: ` - - {{ food.viewValue }} - + @for (food of foods; track food) { + {{ food.viewValue }} + } `, @@ -5181,9 +5196,9 @@ class BasicSelectWithoutFormsPreselected { template: ` - - {{ food.viewValue }} - + @for (food of foods; track food) { + {{ food.viewValue }} + } `, @@ -5207,9 +5222,9 @@ class BasicSelectWithoutFormsMultiple { {{ select.selected?.viewValue.split('').reverse().join('') }} - - {{ food.viewValue }} - + @for (food of foods; track food) { + {{ food.viewValue }} + }
    `, @@ -5228,7 +5243,9 @@ class SelectWithCustomTrigger { - {{ food.viewValue }} + @for (food of foods; track food) { + {{ food.viewValue }} + } `, @@ -5273,9 +5290,9 @@ class NgModelCompareWithSelect { @Component({ template: ` - - {{ food.viewValue }} - + @for (food of foods; track food) { + {{ food.viewValue }} + } `, }) @@ -5293,9 +5310,9 @@ class CustomErrorBehaviorSelect { template: ` - {{ food.viewValue }} - + @for (food of foods; track food) { + {{ food.viewValue }} + } `, @@ -5318,9 +5335,9 @@ class SingleSelectWithPreselectedArrayValues { template: ` - - {{ food.viewValue }} - + @for (food of foods; track food) { + {{ food.viewValue }} + } `, @@ -5361,9 +5378,11 @@ class SelectWithFormFieldLabel { template: ` Select something - - One - + @if (showSelect) { + + One + + } `, }) @@ -5375,7 +5394,9 @@ class SelectWithNgIfAndLabel { template: ` - {{item}} + @for (item of items; track item) { + {{item}} + } `, @@ -5416,13 +5437,13 @@ class SelectWithResetOptionAndFormControl { selector: 'select-with-placeholder-in-ngcontainer-with-ngIf', template: ` - + @if (true) { A B C - + } `, }) @@ -5458,17 +5479,23 @@ class SelectInsideDynamicFormGroup { template: `
    - Select a food + @if (hasLabel) { + Select a food + } - - {{ food.viewValue }} - + @for (food of foods; track food) { + + {{ food.viewValue }} + + } - {{ hint }} + @if (hint) { + {{ hint }} + }
    `, @@ -5512,9 +5539,9 @@ class BasicSelectWithFirstAndLastOptionDisabled { Select a food - {{ food.viewValue }} - + @for (food of foods; track food) { + {{ food.viewValue }} + } diff --git a/src/material/select/testing/select-harness.spec.ts b/src/material/select/testing/select-harness.spec.ts index 454da02187e4..c2bb067a24d4 100644 --- a/src/material/select/testing/select-harness.spec.ts +++ b/src/material/select/testing/select-harness.spec.ts @@ -270,26 +270,34 @@ describe('MatSelectHarness', () => { template: ` - {{ state.name }} + @for (state of states; track state) { + {{ state.name }} + } - {{ state.name }} + @for (state of states; track state) { + {{ state.name }} +} - - {{ state.name }} - + @for (group of stateGroups; track group) { + + @for (state of group.states; track state) { + {{ state.name }} + } + + } - {{ state.name }} + @for (state of states; track state) { + {{ state.name }} + } `, diff --git a/src/material/sidenav/drawer.spec.ts b/src/material/sidenav/drawer.spec.ts index 3758567e0f39..480d8ac16531 100644 --- a/src/material/sidenav/drawer.spec.ts +++ b/src/material/sidenav/drawer.spec.ts @@ -1284,7 +1284,9 @@ class DrawerWithoutFocusableElements {} @Component({ template: ` - Drawer + @if (showDrawer) { + Drawer + } `, }) @@ -1296,7 +1298,9 @@ class DrawerDelayed { @Component({ template: ` - + @if (renderDrawer) { + + } `, }) class DrawerContainerStateChangesTestApp { @@ -1336,13 +1340,13 @@ class DrawerContainerWithContent { } @Component({ - // Note that we need the `ng-container` with the `ngSwitch` so that - // there's a directive between the container and the drawer. + // Note that we need the `@if` so that there's an embedded + // view between the container and the drawer. template: ` - + @if (true) { Drawer - + } `, }) class IndirectDescendantDrawer { diff --git a/src/material/sidenav/sidenav.spec.ts b/src/material/sidenav/sidenav.spec.ts index d1d5604178c7..ba0b49b5c34e 100644 --- a/src/material/sidenav/sidenav.spec.ts +++ b/src/material/sidenav/sidenav.spec.ts @@ -105,13 +105,13 @@ class SidenavWithFixedPosition { } @Component({ - // Note that we need the `ng-container` with the `ngSwitch` so that - // there's a directive between the container and the sidenav. + // Note that we need the `@if` so that there's an embedded + // view between the container and the sidenav. template: ` - + @if (true) { Sidenav. - + } Some content. `, }) diff --git a/src/material/snack-bar/snack-bar.spec.ts b/src/material/snack-bar/snack-bar.spec.ts index b04988967c32..53fe0e94b9a6 100644 --- a/src/material/snack-bar/snack-bar.spec.ts +++ b/src/material/snack-bar/snack-bar.spec.ts @@ -1091,7 +1091,7 @@ class DirectiveWithViewContainer { @Component({ selector: 'arbitrary-component', - template: ``, + template: `@if (childComponentExists) {}`, }) class ComponentWithChildViewContainer { @ViewChild(DirectiveWithViewContainer) childWithViewContainer: DirectiveWithViewContainer; diff --git a/src/material/sort/testing/sort-harness.spec.ts b/src/material/sort/testing/sort-harness.spec.ts index ee34924a2e26..017765e65758 100644 --- a/src/material/sort/testing/sort-harness.spec.ts +++ b/src/material/sort/testing/sort-harness.spec.ts @@ -127,13 +127,15 @@ describe('MatSortHarness', () => { Protein - - {{dessert.name}} - {{dessert.calories}} - {{dessert.fat}} - {{dessert.carbs}} - {{dessert.protein}} - + @for (dessert of sortedData; track dessert) { + + {{dessert.name}} + {{dessert.calories}} + {{dessert.fat}} + {{dessert.carbs}} + {{dessert.protein}} + + } `, }) diff --git a/src/material/stepper/stepper.spec.ts b/src/material/stepper/stepper.spec.ts index ac8fcefb6a69..5e33dc892298 100644 --- a/src/material/stepper/stepper.spec.ts +++ b/src/material/stepper/stepper.spec.ts @@ -1894,14 +1894,16 @@ class SimpleMatHorizontalStepperApp {
    - - Step 2 - Content 2 -
    - - -
    -
    + @if (showStepTwo) { + + Step 2 + Content 2 +
    + + +
    +
    + } Content 3
    @@ -1988,10 +1990,9 @@ class SimplePreselectedMatHorizontalStepperApp { @Component({ template: ` - + @for (step of steps; track step) { + + } `, }) @@ -2006,11 +2007,12 @@ class SimpleStepperWithoutStepControl { @Component({ template: ` - + @for (step of steps; track step) { + + } `, }) @@ -2058,13 +2060,13 @@ class IconOverridesStepper { @Component({ template: ` - + @if (true) { Custom edit Custom done {{getRomanNumeral(index + 1)}} - + } Content 1 Content 2 @@ -2103,11 +2105,11 @@ class StepperWithAriaInputs { @Component({ template: ` - + @if (true) { Content 1 Content 2 Content 3 - + } `, }) @@ -2120,9 +2122,11 @@ class StepperWithIndirectDescendantSteps {} Step 1 - - Step 2 - + @if (showStep2) { + + Step 2 + + } `, }) @@ -2187,7 +2191,9 @@ class StepperWithLazyContent { template: ` Content 1 - Content 2 + @if (renderSecondStep) { + Content 2 + } Content 3 `, diff --git a/src/material/tabs/tab-group.spec.ts b/src/material/tabs/tab-group.spec.ts index 31b468ec456a..a392c10ded1f 100644 --- a/src/material/tabs/tab-group.spec.ts +++ b/src/material/tabs/tab-group.spec.ts @@ -1158,10 +1158,12 @@ class SimpleTabsTestApp { (focusChange)="handleFocus($event)" (selectedTabChange)="handleSelection($event)" [disablePagination]="disablePagination"> - - {{tab.label}} - {{tab.content}} - + @for (tab of tabs; track tab) { + + {{tab.label}} + {{tab.content}} + + } `, }) @@ -1186,9 +1188,9 @@ class SimpleDynamicTabsTestApp { @Component({ template: ` - - {{tab.content}} - + @for (tab of tabs; track tab) { + {{tab.content}} + } `, }) @@ -1234,10 +1236,12 @@ class DisabledTabsTestApp { @Component({ template: ` - - {{ tab.label }} - {{ tab.content }} - + @for (tab of tabs | async; track tab) { + + {{ tab.label }} + {{ tab.content }} + + } `, }) @@ -1327,7 +1331,9 @@ class TabGroupWithAriaInputs { Broccoli, spinach -
    pizza is active
    + @if (pizza.isActive) { +
    pizza is active
    + } `, }) class TabGroupWithIsActiveBinding {} @@ -1345,10 +1351,10 @@ class TabsWithCustomAnimationDuration {} @Component({ template: ` - + @if (true) { Tab one content Tab two content - + } `, }) diff --git a/src/material/tabs/tab-header.spec.ts b/src/material/tabs/tab-header.spec.ts index fda6f442ab51..920cb195f12b 100644 --- a/src/material/tabs/tab-header.spec.ts +++ b/src/material/tabs/tab-header.spec.ts @@ -723,12 +723,11 @@ interface Tab { (indexFocused)="focusedIndex = $event" (selectFocusedIndex)="selectedIndex = $event" [disablePagination]="disablePagination"> -
    - {{tab.label}} -
    + (click)="selectedIndex = i">{{tab.label}}
    + } `, diff --git a/src/material/tabs/tab-nav-bar/tab-nav-bar.spec.ts b/src/material/tabs/tab-nav-bar/tab-nav-bar.spec.ts index df4c41485d37..e1a749f65ad2 100644 --- a/src/material/tabs/tab-nav-bar/tab-nav-bar.spec.ts +++ b/src/material/tabs/tab-nav-bar/tab-nav-bar.spec.ts @@ -526,14 +526,13 @@ describe('MatTabNavBar with enabled animations', () => { [disableRipple]="disableRippleOnBar" [fitInkBarToContent]="fitInkBarToContent" [tabPanel]="tabPanel"> - - Tab link {{label}} - + @for (tab of tabs; track tab; let index = $index) { + Tab link {{label}} + } Tab panel `, @@ -555,7 +554,9 @@ class SimpleTabNavBarTestApp { @Component({ template: ` Tab panel `, @@ -567,7 +568,9 @@ class TabLinkWithNgIf { @Component({ template: ` Tab panel `, @@ -579,7 +582,9 @@ class TabBarWithInactiveTabsOnInit { @Component({ template: ` , `, diff --git a/src/material/toolbar/toolbar.spec.ts b/src/material/toolbar/toolbar.spec.ts index 524ff148a570..2989dd7fc838 100644 --- a/src/material/toolbar/toolbar.spec.ts +++ b/src/material/toolbar/toolbar.spec.ts @@ -128,7 +128,9 @@ class ToolbarMultipleRows {} template: ` First Row - Second Row + @if (showToolbarRow) { + Second Row + } `, }) @@ -140,10 +142,10 @@ class ToolbarMixedRowModes { // The ng-container is there so we have a node with a directive between the toolbar and the rows. template: ` - + @if (true) { First Row Second Row - + } `, }) diff --git a/src/material/tooltip/tooltip.spec.ts b/src/material/tooltip/tooltip.spec.ts index 12f86924974f..393e841614c9 100644 --- a/src/material/tooltip/tooltip.spec.ts +++ b/src/material/tooltip/tooltip.spec.ts @@ -1533,14 +1533,13 @@ describe('MDC-based MatTooltip', () => { @Component({ selector: 'app', template: ` - `, + @if (showButton) { + + }`, }) class BasicTooltipDemo { position: string = 'below'; @@ -1557,11 +1556,11 @@ class BasicTooltipDemo { template: `
    - + [matTooltipPosition]="position">Button + }
    `, }) class ScrollableTooltipDemo { @@ -1599,10 +1598,10 @@ class OnPushTooltipDemo { @Component({ selector: 'app', template: ` - `, + @for (tooltip of tooltips; track tooltip) { + + } + `, }) class DynamicTooltipsDemo { tooltips: string[] = []; diff --git a/src/material/tree/tree.spec.ts b/src/material/tree/tree.spec.ts index 76774f7584de..7091498106cc 100644 --- a/src/material/tree/tree.spec.ts +++ b/src/material/tree/tree.spec.ts @@ -937,9 +937,11 @@ class NestedMatTreeApp { >>> {{node.pizzaTopping}} - {{node.pizzaCheese}} + {{node.pizzaBase}} -
    - -
    + @if (treeControl.isExpanded(node)) { +
    + +
    + }
    `, @@ -1012,9 +1014,11 @@ class MatTreeAppWithToggle { {{node.pizzaTopping}} - {{node.pizzaCheese}} + {{node.pizzaBase}} -
    - -
    + @if (treeControl.isExpanded(node)) { +
    + +
    + }
    `, diff --git a/src/youtube-player/youtube-player.spec.ts b/src/youtube-player/youtube-player.spec.ts index ec3e45d9818c..777be4fb2e20 100644 --- a/src/youtube-player/youtube-player.spec.ts +++ b/src/youtube-player/youtube-player.spec.ts @@ -554,17 +554,19 @@ describe('YoutubePlayer', () => { @Component({ selector: 'test-app', template: ` - - + @if (visible) { + + + } `, }) class TestApp {