@igniteui/angular-templates 21.1.14100-alpha.2 → 21.1.14100-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/igx-ts/projects/_base/files/__dot__claude/skills/igniteui-angular-components/SKILL.md +68 -0
- package/igx-ts/projects/_base/files/__dot__claude/skills/igniteui-angular-components/references/charts.md +457 -0
- package/igx-ts/projects/_base/files/__dot__claude/skills/igniteui-angular-components/references/data-display.md +360 -0
- package/igx-ts/projects/_base/files/__dot__claude/skills/igniteui-angular-components/references/directives.md +272 -0
- package/igx-ts/projects/_base/files/__dot__claude/skills/igniteui-angular-components/references/feedback.md +149 -0
- package/igx-ts/projects/_base/files/__dot__claude/skills/igniteui-angular-components/references/form-controls.md +313 -0
- package/igx-ts/projects/_base/files/__dot__claude/skills/igniteui-angular-components/references/layout-manager.md +420 -0
- package/igx-ts/projects/_base/files/__dot__claude/skills/igniteui-angular-components/references/layout.md +225 -0
- package/igx-ts/projects/_base/files/__dot__claude/skills/igniteui-angular-components/references/setup.md +166 -0
- package/igx-ts/projects/_base/files/__dot__claude/skills/igniteui-angular-grids/SKILL.md +110 -0
- package/igx-ts/projects/_base/files/__dot__claude/skills/igniteui-angular-grids/references/data-operations.md +445 -0
- package/igx-ts/projects/_base/files/__dot__claude/skills/igniteui-angular-grids/references/editing.md +491 -0
- package/igx-ts/projects/_base/files/__dot__claude/skills/igniteui-angular-grids/references/features.md +234 -0
- package/igx-ts/projects/_base/files/__dot__claude/skills/igniteui-angular-grids/references/paging-remote.md +397 -0
- package/igx-ts/projects/_base/files/__dot__claude/skills/igniteui-angular-grids/references/state.md +314 -0
- package/igx-ts/projects/_base/files/__dot__claude/skills/igniteui-angular-grids/references/structure.md +299 -0
- package/igx-ts/projects/_base/files/__dot__claude/skills/igniteui-angular-grids/references/types.md +507 -0
- package/igx-ts/projects/_base/files/__dot__claude/skills/igniteui-angular-theming/SKILL.md +439 -0
- package/igx-ts/projects/_base/files/__dot__claude/skills/igniteui-angular-theming/references/common-patterns.md +45 -0
- package/igx-ts/projects/_base/files/__dot__claude/skills/igniteui-angular-theming/references/contributing.md +471 -0
- package/igx-ts/projects/_base/files/__dot__claude/skills/igniteui-angular-theming/references/mcp-setup.md +77 -0
- package/igx-ts/projects/_base/files/__dot__vscode/mcp.json +2 -2
- package/package.json +2 -2
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# Feedback & Overlay Components
|
|
2
|
+
|
|
3
|
+
> **Part of the [`igniteui-angular-components`](../SKILL.md) skill hub.**
|
|
4
|
+
> For app setup, providers, and import patterns — see [`setup.md`](./setup.md).
|
|
5
|
+
|
|
6
|
+
> **AGENT INSTRUCTION:** All components in this file rely on Angular animations and the Ignite UI overlay system. Before using any of them, ensure `provideAnimations()` (or `provideAnimationsAsync()`) is present in `app.config.ts`. If it is missing, add it — these components will throw runtime errors or silently fail to animate without it.
|
|
7
|
+
|
|
8
|
+
## Contents
|
|
9
|
+
|
|
10
|
+
- [Dialog](#dialog)
|
|
11
|
+
- [Snackbar](#snackbar)
|
|
12
|
+
- [Toast](#toast)
|
|
13
|
+
- [Banner](#banner)
|
|
14
|
+
- [Key Rules](#key-rules)
|
|
15
|
+
|
|
16
|
+
## Dialog
|
|
17
|
+
|
|
18
|
+
> **Docs:** [Dialog Component](https://www.infragistics.com/products/ignite-ui-angular/angular/components/dialog)
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
import { IgxDialogComponent, IgxDialogTitleDirective, IgxDialogActionsDirective } from 'igniteui-angular/dialog';
|
|
22
|
+
import { IgxButtonDirective } from 'igniteui-angular/directives';
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
```html
|
|
26
|
+
<igx-dialog
|
|
27
|
+
#confirmDialog
|
|
28
|
+
[isModal]="true"
|
|
29
|
+
[closeOnEscape]="true"
|
|
30
|
+
[closeOnOutsideSelect]="false"
|
|
31
|
+
title="Confirm Delete"
|
|
32
|
+
(closed)="onDialogClosed()">
|
|
33
|
+
<igx-dialog-title>Confirm Delete</igx-dialog-title>
|
|
34
|
+
<p>Are you sure you want to delete this item? This action cannot be undone.</p>
|
|
35
|
+
<div igxDialogActions>
|
|
36
|
+
<button igxButton="flat" (click)="confirmDialog.close()">Cancel</button>
|
|
37
|
+
<button igxButton="raised" (click)="deleteItem(); confirmDialog.close()">Delete</button>
|
|
38
|
+
</div>
|
|
39
|
+
</igx-dialog>
|
|
40
|
+
|
|
41
|
+
<button igxButton="raised" (click)="confirmDialog.open()">Delete Item</button>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Programmatic control:
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
dialog = viewChild.required<IgxDialogComponent>('confirmDialog');
|
|
48
|
+
|
|
49
|
+
open() { this.dialog().open(); }
|
|
50
|
+
close() { this.dialog().close(); }
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Events: `(opening)`, `(opened)`, `(closing)`, `(closed)`, `(leftButtonSelect)`, `(rightButtonSelect)`.
|
|
54
|
+
|
|
55
|
+
## Snackbar
|
|
56
|
+
|
|
57
|
+
> **Docs:** [Snackbar Component](https://www.infragistics.com/products/ignite-ui-angular/angular/components/snackbar)
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
import { IgxSnackbarComponent, IgxSnackbarActionDirective } from 'igniteui-angular/snackbar';
|
|
61
|
+
import { IgxButtonDirective } from 'igniteui-angular/directives';
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
```html
|
|
65
|
+
<igx-snackbar
|
|
66
|
+
#snackbar
|
|
67
|
+
[displayTime]="3000"
|
|
68
|
+
[autoHide]="true"
|
|
69
|
+
(animationDone)="onSnackbarDone()">
|
|
70
|
+
Item saved successfully
|
|
71
|
+
<button igxButton="flat" igxSnackbarAction (click)="undo()">UNDO</button>
|
|
72
|
+
</igx-snackbar>
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Trigger in TypeScript:
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
snackbar = viewChild.required<IgxSnackbarComponent>('snackbar');
|
|
79
|
+
|
|
80
|
+
save() {
|
|
81
|
+
this.dataService.save(this.item);
|
|
82
|
+
this.snackbar().open('Item saved'); // optional: pass message text
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Toast
|
|
87
|
+
|
|
88
|
+
> **Docs:** [Toast Component](https://www.infragistics.com/products/ignite-ui-angular/angular/components/toast)
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
import { IgxToastComponent } from 'igniteui-angular/toast';
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
```html
|
|
95
|
+
<igx-toast #toast [displayTime]="2000">Operation complete</igx-toast>
|
|
96
|
+
|
|
97
|
+
<button igxButton (click)="toast.open()">Trigger Toast</button>
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Toast vs Snackbar: Toast is non-interactive (no action button), always auto-hides. Snackbar supports an action button and can be persistent.
|
|
101
|
+
|
|
102
|
+
## Banner
|
|
103
|
+
|
|
104
|
+
> **Docs:** [Banner Component](https://www.infragistics.com/products/ignite-ui-angular/angular/components/banner)
|
|
105
|
+
|
|
106
|
+
```typescript
|
|
107
|
+
import { IgxBannerComponent, IgxBannerActionsDirective } from 'igniteui-angular/banner';
|
|
108
|
+
import { IgxIconComponent } from 'igniteui-angular/icon';
|
|
109
|
+
import { IgxButtonDirective } from 'igniteui-angular/directives';
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
```html
|
|
113
|
+
<igx-banner #banner (closed)="onBannerClosed()">
|
|
114
|
+
<igx-icon igxBannerIcon>wifi_off</igx-icon>
|
|
115
|
+
You are offline. Some features may not be available.
|
|
116
|
+
<div igxBannerActions>
|
|
117
|
+
<button igxButton="flat" (click)="banner.dismiss()">Dismiss</button>
|
|
118
|
+
<button igxButton="flat" (click)="retry()">Retry</button>
|
|
119
|
+
</div>
|
|
120
|
+
</igx-banner>
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Trigger in TypeScript:
|
|
124
|
+
|
|
125
|
+
```typescript
|
|
126
|
+
banner = viewChild.required<IgxBannerComponent>('banner');
|
|
127
|
+
|
|
128
|
+
showOfflineWarning() { this.banner().open(); }
|
|
129
|
+
hideWarning() { this.banner().close(); }
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Events: `(opening)`, `(opened)`, `(closing)`, `(closed)`.
|
|
133
|
+
|
|
134
|
+
Banner always renders inline (not overlaid) — it pushes page content down when open.
|
|
135
|
+
|
|
136
|
+
## Key Rules
|
|
137
|
+
|
|
138
|
+
- **`provideAnimations()` is required** — add it to `app.config.ts` before using Dialog, Snackbar, Toast, or Banner
|
|
139
|
+
- **Dialog** uses the Ignite UI overlay system — set `[isModal]="true"` for blocking modals
|
|
140
|
+
- **Snackbar** vs **Toast**: Snackbar supports action buttons and can be persistent; Toast is always auto-hiding and non-interactive
|
|
141
|
+
- **Banner** renders **inline** (pushes content), not as an overlay — use Dialog for blocking prompts
|
|
142
|
+
|
|
143
|
+
## See Also
|
|
144
|
+
|
|
145
|
+
- [`setup.md`](./setup.md) — App providers, architecture, all entry points
|
|
146
|
+
- [`form-controls.md`](./form-controls.md) — Input Group, Combo, Select, Date/Time Pickers, Calendar, Checkbox, Radio, Switch, Slider
|
|
147
|
+
- [`layout.md`](./layout.md) — Tabs, Stepper, Accordion, Splitter, Navigation Drawer
|
|
148
|
+
- [`data-display.md`](./data-display.md) — List, Tree, Card and other display components
|
|
149
|
+
- [`directives.md`](./directives.md) — Button, Ripple, Tooltip, Drag and Drop
|
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
# Form Controls & Reactive Forms Integration
|
|
2
|
+
|
|
3
|
+
> **Part of the [`igniteui-angular-components`](../SKILL.md) skill hub.**
|
|
4
|
+
> For app setup, providers, and import patterns — see [`setup.md`](./setup.md).
|
|
5
|
+
|
|
6
|
+
## Contents
|
|
7
|
+
|
|
8
|
+
- [Input Group](#input-group)
|
|
9
|
+
- [Combo (Multi-Select Dropdown)](#combo-multi-select-dropdown)
|
|
10
|
+
- [Simple Combo (Single-Select)](#simple-combo-single-select)
|
|
11
|
+
- [Select](#select)
|
|
12
|
+
- [Date Picker](#date-picker)
|
|
13
|
+
- [Date Range Picker](#date-range-picker)
|
|
14
|
+
- [Time Picker](#time-picker)
|
|
15
|
+
- [Calendar](#calendar)
|
|
16
|
+
- [Checkbox, Radio, Switch](#checkbox-radio-switch)
|
|
17
|
+
- [Slider](#slider)
|
|
18
|
+
- [Reactive Forms Integration](#reactive-forms-integration)
|
|
19
|
+
- [Key Rules](#key-rules)
|
|
20
|
+
|
|
21
|
+
## Input Group
|
|
22
|
+
|
|
23
|
+
> **Docs:** [Input Group](https://www.infragistics.com/products/ignite-ui-angular/angular/components/input-group)
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
import { IGX_INPUT_GROUP_DIRECTIVES } from 'igniteui-angular/input-group';
|
|
27
|
+
import { IgxIconComponent } from 'igniteui-angular/icon';
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
```html
|
|
31
|
+
<igx-input-group type="border">
|
|
32
|
+
<igx-prefix><igx-icon>person</igx-icon></igx-prefix>
|
|
33
|
+
<label igxLabel>Username</label>
|
|
34
|
+
<input igxInput name="username" type="text" [(ngModel)]="username" />
|
|
35
|
+
<igx-suffix><igx-icon>clear</igx-icon></igx-suffix>
|
|
36
|
+
<igx-hint>Enter your username</igx-hint>
|
|
37
|
+
</igx-input-group>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Types: `line` (default), `border`, `box`, `search`.
|
|
41
|
+
|
|
42
|
+
## Combo (Multi-Select Dropdown)
|
|
43
|
+
|
|
44
|
+
> **Docs:** [Combo Component](https://www.infragistics.com/products/ignite-ui-angular/angular/components/combo)
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
import { IgxComboComponent } from 'igniteui-angular/combo';
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
```html
|
|
51
|
+
<igx-combo
|
|
52
|
+
[data]="cities"
|
|
53
|
+
[valueKey]="'id'"
|
|
54
|
+
[displayKey]="'name'"
|
|
55
|
+
[groupKey]="'region'"
|
|
56
|
+
placeholder="Select cities"
|
|
57
|
+
[allowCustomValues]="false"
|
|
58
|
+
[(ngModel)]="selectedCityIds">
|
|
59
|
+
</igx-combo>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Key inputs: `[data]`, `[valueKey]`, `[displayKey]`, `[groupKey]`, `[placeholder]`, `[allowCustomValues]`, `[filterFunction]`, `[itemsMaxHeight]`, `[type]`.
|
|
63
|
+
|
|
64
|
+
Events: `(opening)`, `(opened)`, `(closing)`, `(closed)`, `(selectionChanging)`, `(addition)`, `(searchInputUpdate)`.
|
|
65
|
+
|
|
66
|
+
## Simple Combo (Single-Select)
|
|
67
|
+
|
|
68
|
+
> **Docs:** [Combo — Single Selection](https://www.infragistics.com/products/ignite-ui-angular/angular/components/combo#single-selection)
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
import { IgxSimpleComboComponent } from 'igniteui-angular/simple-combo';
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
```html
|
|
75
|
+
<igx-simple-combo
|
|
76
|
+
[data]="countries"
|
|
77
|
+
[valueKey]="'code'"
|
|
78
|
+
[displayKey]="'name'"
|
|
79
|
+
placeholder="Select country"
|
|
80
|
+
[(ngModel)]="selectedCountry">
|
|
81
|
+
</igx-simple-combo>
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Same API as `igx-combo` but restricted to single selection.
|
|
85
|
+
|
|
86
|
+
## Select
|
|
87
|
+
|
|
88
|
+
> **Docs:** [Select Component](https://www.infragistics.com/products/ignite-ui-angular/angular/components/select)
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
import { IgxSelectComponent, IgxSelectItemComponent } from 'igniteui-angular/select';
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
```html
|
|
95
|
+
<igx-select [(ngModel)]="selectedRole" placeholder="Choose role">
|
|
96
|
+
@for (role of roles; track role.id) {
|
|
97
|
+
<igx-select-item [value]="role.id">{{ role.name }}</igx-select-item>
|
|
98
|
+
}
|
|
99
|
+
</igx-select>
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Date Picker
|
|
103
|
+
|
|
104
|
+
> **Docs:** [Date Picker](https://www.infragistics.com/products/ignite-ui-angular/angular/components/date-picker)
|
|
105
|
+
|
|
106
|
+
```typescript
|
|
107
|
+
import { IgxDatePickerComponent } from 'igniteui-angular/date-picker';
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
```html
|
|
111
|
+
<igx-date-picker
|
|
112
|
+
[(ngModel)]="selectedDate"
|
|
113
|
+
[minValue]="minDate"
|
|
114
|
+
[maxValue]="maxDate"
|
|
115
|
+
[hideOutsideDays]="true"
|
|
116
|
+
[displayMonthsCount]="2">
|
|
117
|
+
</igx-date-picker>
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Implements `ControlValueAccessor` and `Validator`. Works with both reactive and template-driven forms.
|
|
121
|
+
|
|
122
|
+
## Date Range Picker
|
|
123
|
+
|
|
124
|
+
> **Docs:** [Date Range Picker](https://www.infragistics.com/products/ignite-ui-angular/angular/components/date-range-picker)
|
|
125
|
+
|
|
126
|
+
```typescript
|
|
127
|
+
import { IgxDateRangePickerComponent } from 'igniteui-angular/date-picker';
|
|
128
|
+
import { IgxDateTimeEditorDirective } from 'igniteui-angular/directives';
|
|
129
|
+
import { IGX_INPUT_GROUP_DIRECTIVES } from 'igniteui-angular/input-group';
|
|
130
|
+
|
|
131
|
+
// import { IgxDateTimeEditorDirective, IGX_INPUT_GROUP_DIRECTIVES } from '@infragistics/igniteui-angular'; for licensed package
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
```html
|
|
135
|
+
<igx-date-range-picker [(ngModel)]="dateRange">
|
|
136
|
+
<igx-date-range-start>
|
|
137
|
+
<input igxInput igxDateTimeEditor type="text" />
|
|
138
|
+
</igx-date-range-start>
|
|
139
|
+
<igx-date-range-end>
|
|
140
|
+
<input igxInput igxDateTimeEditor type="text" />
|
|
141
|
+
</igx-date-range-end>
|
|
142
|
+
</igx-date-range-picker>
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Time Picker
|
|
146
|
+
|
|
147
|
+
> **Docs:** [Time Picker](https://www.infragistics.com/products/ignite-ui-angular/angular/components/time-picker)
|
|
148
|
+
|
|
149
|
+
```typescript
|
|
150
|
+
import { IgxTimePickerComponent } from 'igniteui-angular/time-picker';
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
```html
|
|
154
|
+
<igx-time-picker
|
|
155
|
+
[(ngModel)]="selectedTime"
|
|
156
|
+
[inputFormat]="'HH:mm'"
|
|
157
|
+
[is24HourFormat]="true">
|
|
158
|
+
</igx-time-picker>
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## Calendar
|
|
162
|
+
|
|
163
|
+
> **Docs:** [Calendar Component](https://www.infragistics.com/products/ignite-ui-angular/angular/components/calendar)
|
|
164
|
+
|
|
165
|
+
```typescript
|
|
166
|
+
import { IgxCalendarComponent } from 'igniteui-angular/calendar';
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
```html
|
|
170
|
+
<igx-calendar
|
|
171
|
+
[(ngModel)]="selectedDate"
|
|
172
|
+
[selection]="'single'"
|
|
173
|
+
[hideOutsideDays]="true"
|
|
174
|
+
[weekStart]="1">
|
|
175
|
+
</igx-calendar>
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
Selection modes: `'single'`, `'multi'`, `'range'`.
|
|
179
|
+
|
|
180
|
+
## Checkbox, Radio, Switch
|
|
181
|
+
|
|
182
|
+
> **Docs:** [Checkbox](https://www.infragistics.com/products/ignite-ui-angular/angular/components/checkbox) · [Radio Button](https://www.infragistics.com/products/ignite-ui-angular/angular/components/radio-button) · [Switch](https://www.infragistics.com/products/ignite-ui-angular/angular/components/switch)
|
|
183
|
+
|
|
184
|
+
```typescript
|
|
185
|
+
import { IgxCheckboxComponent } from 'igniteui-angular/checkbox';
|
|
186
|
+
import { IgxRadioComponent, IgxRadioGroupDirective } from 'igniteui-angular/radio';
|
|
187
|
+
import { IgxSwitchComponent } from 'igniteui-angular/switch';
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
```html
|
|
191
|
+
<igx-checkbox [(ngModel)]="rememberMe">Remember me</igx-checkbox>
|
|
192
|
+
|
|
193
|
+
<igx-radio-group>
|
|
194
|
+
<igx-radio name="plan" value="basic" [(ngModel)]="plan">Basic</igx-radio>
|
|
195
|
+
<igx-radio name="plan" value="pro" [(ngModel)]="plan">Pro</igx-radio>
|
|
196
|
+
</igx-radio-group>
|
|
197
|
+
|
|
198
|
+
<igx-switch [(ngModel)]="darkMode">Dark mode</igx-switch>
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
## Slider
|
|
202
|
+
|
|
203
|
+
> **Docs:** [Slider Component](https://www.infragistics.com/products/ignite-ui-angular/angular/components/slider/slider)
|
|
204
|
+
|
|
205
|
+
```typescript
|
|
206
|
+
import { IgxSliderComponent, IgxSliderType } from 'igniteui-angular/slider';
|
|
207
|
+
|
|
208
|
+
public sliderType = IgxSliderType;
|
|
209
|
+
public priceRange = {
|
|
210
|
+
lower: 200,
|
|
211
|
+
upper: 800
|
|
212
|
+
};
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
```html
|
|
216
|
+
<!-- Single value -->
|
|
217
|
+
<igx-slider [minValue]="0" [maxValue]="100" [(ngModel)]="volume"></igx-slider>
|
|
218
|
+
|
|
219
|
+
<!-- Range slider -->
|
|
220
|
+
<igx-slider
|
|
221
|
+
[type]="sliderType.RANGE"
|
|
222
|
+
[minValue]="0"
|
|
223
|
+
[maxValue]="100"
|
|
224
|
+
[lowerBound]="20"
|
|
225
|
+
[upperBound]="80">
|
|
226
|
+
</igx-slider>
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
## Reactive Forms Integration
|
|
230
|
+
|
|
231
|
+
All form controls implement `ControlValueAccessor` and work with both reactive and template-driven forms.
|
|
232
|
+
|
|
233
|
+
> **Docs:** [Angular Reactive Form Validation](https://www.infragistics.com/products/ignite-ui-angular/angular/components/angular-reactive-form-validation)
|
|
234
|
+
|
|
235
|
+
```typescript
|
|
236
|
+
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
237
|
+
import { FormGroup, FormControl, Validators, ReactiveFormsModule } from '@angular/forms';
|
|
238
|
+
import { IgxComboComponent } from 'igniteui-angular/combo';
|
|
239
|
+
import { IGX_INPUT_GROUP_DIRECTIVES } from 'igniteui-angular/input-group';
|
|
240
|
+
import { IgxDatePickerComponent } from 'igniteui-angular/date-picker';
|
|
241
|
+
import { IgxSelectComponent, IgxSelectItemComponent } from 'igniteui-angular/select';
|
|
242
|
+
|
|
243
|
+
@Component({
|
|
244
|
+
selector: 'app-my-form',
|
|
245
|
+
imports: [
|
|
246
|
+
ReactiveFormsModule,
|
|
247
|
+
IGX_INPUT_GROUP_DIRECTIVES,
|
|
248
|
+
IgxComboComponent,
|
|
249
|
+
IgxDatePickerComponent,
|
|
250
|
+
IgxSelectComponent,
|
|
251
|
+
IgxSelectItemComponent
|
|
252
|
+
],
|
|
253
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
254
|
+
template: `
|
|
255
|
+
<form [formGroup]="form" (ngSubmit)="submit()">
|
|
256
|
+
<igx-input-group>
|
|
257
|
+
<label igxLabel>Name</label>
|
|
258
|
+
<input igxInput formControlName="name" />
|
|
259
|
+
@if (form.controls.name.invalid && form.controls.name.touched) {
|
|
260
|
+
<igx-hint>Name is required</igx-hint>
|
|
261
|
+
}
|
|
262
|
+
</igx-input-group>
|
|
263
|
+
|
|
264
|
+
<igx-combo
|
|
265
|
+
[data]="skills"
|
|
266
|
+
formControlName="skills"
|
|
267
|
+
[valueKey]="'id'"
|
|
268
|
+
[displayKey]="'name'"
|
|
269
|
+
placeholder="Select skills">
|
|
270
|
+
</igx-combo>
|
|
271
|
+
|
|
272
|
+
<igx-date-picker formControlName="startDate"></igx-date-picker>
|
|
273
|
+
|
|
274
|
+
<igx-select formControlName="role" placeholder="Choose role">
|
|
275
|
+
@for (r of roles; track r.id) {
|
|
276
|
+
<igx-select-item [value]="r.id">{{ r.name }}</igx-select-item>
|
|
277
|
+
}
|
|
278
|
+
</igx-select>
|
|
279
|
+
</form>
|
|
280
|
+
`
|
|
281
|
+
})
|
|
282
|
+
export class MyFormComponent {
|
|
283
|
+
form = new FormGroup({
|
|
284
|
+
name: new FormControl('', Validators.required),
|
|
285
|
+
skills: new FormControl<number[]>([]),
|
|
286
|
+
startDate: new FormControl<Date | null>(null),
|
|
287
|
+
role: new FormControl<string | null>(null)
|
|
288
|
+
});
|
|
289
|
+
|
|
290
|
+
skills = [{ id: 1, name: 'Angular' }, { id: 2, name: 'TypeScript' }];
|
|
291
|
+
roles = [{ id: 'admin', name: 'Admin' }, { id: 'user', name: 'User' }];
|
|
292
|
+
|
|
293
|
+
submit() {
|
|
294
|
+
if (this.form.valid) {
|
|
295
|
+
console.log(this.form.value);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
## Key Rules
|
|
302
|
+
|
|
303
|
+
- **Always check `app.config.ts` first** — add `provideAnimations()` before using Combo, Select, Date Picker, or any overlay component
|
|
304
|
+
- **Import from specific entry points** — avoid the root `igniteui-angular` barrel
|
|
305
|
+
- Date/Time pickers implement both `ControlValueAccessor` and `Validator` — they integrate with reactive forms natively
|
|
306
|
+
|
|
307
|
+
## See Also
|
|
308
|
+
|
|
309
|
+
- [`setup.md`](./setup.md) — App providers, architecture, all entry points
|
|
310
|
+
- [`layout.md`](./layout.md) — Tabs, Stepper, Accordion, Splitter, Navigation Drawer
|
|
311
|
+
- [`data-display.md`](./data-display.md) — List, Tree, Card and other display components
|
|
312
|
+
- [`feedback.md`](./feedback.md) — Dialog, Snackbar, Toast, Banner
|
|
313
|
+
- [`directives.md`](./directives.md) — Button, Ripple, Tooltip, Drag and Drop
|