forked from angular/components
-
Notifications
You must be signed in to change notification settings - Fork 9
/
list-demo.ts
91 lines (79 loc) · 2.54 KB
/
list-demo.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {Component} from '@angular/core';
import {CommonModule} from '@angular/common';
import {FormsModule} from '@angular/forms';
import {MatButtonModule} from '@angular/material/button';
import {MatLegacyCheckboxModule} from '@angular/material/legacy-checkbox';
import {MatIconModule} from '@angular/material/icon';
import {
MatLegacyListModule,
MatLegacyListOptionCheckboxPosition,
} from '@angular/material/legacy-list';
@Component({
selector: 'list-demo',
templateUrl: 'list-demo.html',
styleUrls: ['list-demo.css'],
standalone: true,
imports: [
CommonModule,
FormsModule,
MatButtonModule,
MatLegacyCheckboxModule,
MatIconModule,
MatLegacyListModule,
],
})
export class ListDemo {
items: string[] = ['Pepper', 'Salt', 'Paprika'];
contacts: {name: string; headline: string}[] = [
{name: 'Nancy', headline: 'Software engineer'},
{name: 'Mary', headline: 'TPM'},
{name: 'Bobby', headline: 'UX designer'},
];
checkboxPosition: MatLegacyListOptionCheckboxPosition = 'before';
messages: {from: string; subject: string; message: string; image: string}[] = [
{
from: 'Nancy',
subject: 'Brunch?',
message: 'Did you want to go on Sunday? I was thinking that might work.',
image: 'https://angular.io/generated/images/bios/cindygreenekaplan.jpg',
},
{
from: 'Mary',
subject: 'Summer BBQ',
message: 'Wish I could come, but I have some prior obligations.',
image: 'https://angular.io/generated/images/bios/twerske.jpg',
},
{
from: 'Bobby',
subject: 'Oui oui',
message: 'Do you have Paris reservations for the 15th? I just booked!',
image: 'https://angular.io/generated/images/bios/jelbourn.jpg',
},
];
links: {name: string}[] = [{name: 'Inbox'}, {name: 'Outbox'}, {name: 'Spam'}, {name: 'Trash'}];
thirdLine = false;
infoClicked = false;
selectionListDisabled = false;
selectionListRippleDisabled = false;
selectedOptions: string[] = ['apples'];
changeEventCount = 0;
modelChangeEventCount = 0;
onSelectedOptionsChange(values: string[]) {
this.selectedOptions = values;
this.modelChangeEventCount++;
}
toggleCheckboxPosition() {
this.checkboxPosition = this.checkboxPosition === 'before' ? 'after' : 'before';
}
favoriteOptions: string[] = [];
alertItem(msg: string) {
alert(msg);
}
}