79739994

Date: 2025-08-19 13:48:23
Score: 1
Natty:
Report link

Tty this:

ts:

import { Component } from '@angular/core';
import { MatListOption, MatSelectionList } from '@angular/material/list';

@Component({
  selector: 'app-list-single-selection',
  standalone: true,
  imports: [MatSelectionList, MatListOption],
  templateUrl: './list-single-selection.component.html'
})

export class listSingleSelectionComponent {
  listOptions = [
    {value: 'boots', name: 'Boots'},
    {value: 'clogs', name: 'Clogs'},
    {value: 'loafers', name: 'Loafers'},
  ]
}

html:

<mat-selection-list [multiple]="false">
    @for (listItem of listOptions; track $index) {
    <mat-list-option [value]="listItem.value">
        {{listItem.name}}
    </mat-list-option>
    }
</mat-selection-list>

https://material.angular.dev/components/list/examples

Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Khashayar Nowruzi