-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathchip-tailwind-styling.component.ts
More file actions
52 lines (45 loc) · 1.52 KB
/
chip-tailwind-styling.component.ts
File metadata and controls
52 lines (45 loc) · 1.52 KB
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
import { ChangeDetectorRef, Component, inject } from '@angular/core';
import { IBaseChipEventArgs, IChipsAreaReorderEventArgs, IgxChipsAreaComponent, IgxChipComponent, IgxIconComponent, IgxPrefixDirective } from 'igniteui-angular';
@Component({
selector: 'app-chip-tailwind-styling',
styleUrls: ['./chip-tailwind-styling.component.scss'],
templateUrl: './chip-tailwind-styling.component.html',
imports: [IgxChipsAreaComponent, IgxChipComponent, IgxIconComponent, IgxPrefixDirective]
})
export class ChipTailwindStylingSampleComponent {
changeDetectionRef = inject(ChangeDetectorRef);
public chipList = [
{
text: 'Country',
id: '1',
icon: 'place'
},
{
text: 'City',
id: '2',
icon: 'location_city'
},
{
text: 'Town',
id: '3',
icon: 'store'
},
{
text: 'First Name',
id: '4',
icon: 'person_pin'
}
];
public chipRemoved(event: IBaseChipEventArgs) {
this.chipList = this.chipList.filter((item) => item.id !== event.owner.id);
this.changeDetectionRef.detectChanges();
}
public chipsOrderChanged(event: IChipsAreaReorderEventArgs) {
const newChipList = [];
for (const chip of event.chipsArray) {
const chipItem = this.chipList.filter((item) => item.id === chip.id)[0];
newChipList.push(chipItem);
}
this.chipList = newChipList;
}
}