Last active
February 27, 2026 07:11
-
-
Save SippieCup/5ff56642dc6ce9c6bd10153cc0bd90a1 to your computer and use it in GitHub Desktop.
PrimeNG with Angular Signals
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type FilterData = { | |
| dateRange: [DateTime, DateTime]; | |
| paymentType: PaymentTypes; | |
| } | |
| @Component({ | |
| selector: 'app-root', | |
| template: ` | |
| <form> | |
| <p-floatlabel variant="on"> | |
| <p-datepicker | |
| selectionMode="range" | |
| [formField]="$any(filterForm.dateRange)" | |
| [showIcon]="true" | |
| [showButtonBar]="true" | |
| luxonForm | |
| ></p-datepicker> | |
| <label>Date Range</label> | |
| </p-floatlabel> | |
| <p-floatlabel> | |
| <p-select | |
| [formField]="$any(filterForm.paymentType)" | |
| [options]="paymentTypes" | |
| /> | |
| <label for="paymentType">Payment Type</label> | |
| </p-floatlabel> | |
| </form> | |
| `, | |
| changeDetection: ChangeDetectionStrategy.OnPush, | |
| imports: [ | |
| FormField, | |
| FloatLabelModule, | |
| DatePickerModule, | |
| LuxonFormDirective, | |
| SelectModule, | |
| ], | |
| }) | |
| export class App { | |
| $filterModel = signal<FilterData>({ | |
| dateRange: [DateTime.now().minus({ weeks: 2 }), DateTime.now()], | |
| paymentType: 'All', | |
| }); | |
| filterForm = form(this.$filterModel); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment