Skip to content

Instantly share code, notes, and snippets.

@SippieCup
Last active February 27, 2026 07:11
Show Gist options
  • Select an option

  • Save SippieCup/5ff56642dc6ce9c6bd10153cc0bd90a1 to your computer and use it in GitHub Desktop.

Select an option

Save SippieCup/5ff56642dc6ce9c6bd10153cc0bd90a1 to your computer and use it in GitHub Desktop.
PrimeNG with Angular Signals
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