Scheduler Data Binding

Display appointments by date, navigate day, week and agenda views, and let your application handle event and time selection.

Application-owned loading

Supply a NgbSchedulerDataSource. It receives the visible civil date range and an AbortSignal. Return events that intersect the range; translate timezone boundaries in your backend integration.

The following example demonstrates asynchronous loading, cancellation and retry. Enable the simulated failure, navigate to another range, then disable it and select Retry.

America/Chicago

Loading schedule…

Select an appointment to open its details, or choose an empty time slot.

      import { NgbSchedulerDataSource, NgbSchedulerEvent } from '@angular-bootstrap/ngbootstrap';

// Application endpoint: validate its response and enforce authorization server-side.
readonly load: NgbSchedulerDataSource = async (range, signal) => {
  const query = new URLSearchParams({
    start: range.start, end: range.end, timeZone: range.timeZone, view: range.view,
  });
  const response = await fetch('/api/appointments?' + query, { signal });
  if (!response.ok) throw new Error('Could not load appointments');
  return await response.json() as NgbSchedulerEvent[];
};
// Template: <ngb-scheduler [(date)]="date" [dataSource]="load" />
    

Loading contract

A datasource takes precedence over events. New ranges cancel previous requests; stale results are ignored. Loading starts after browser rendering, and failures display Retry. Return at most 10,000 events per range.

Use the datasource or rangeChange for loading, not both. The library does not provide HTTP endpoints, authorization, caching or persistence.

Event preview

The following example enables showEventPreview. Activate an appointment to read its complete dates, localized times and description in a modal dialog. Escape or Close dismisses it and returns focus to the appointment. The existing eventActivate output still fires once.

Preview is disabled by default. Applications can also call openEventPreview(event) for a loaded event and closeEventPreview(). Descriptions are plain text. Without a mutationHandler, this dialog remains read-only. See Editing for opt-in edit and delete actions.

Dates and selection

Set date as YYYY-MM-DD. Timed events use ISO timestamps with an explicit offset; all-day events use date-only values. End dates and times are exclusive. Replace event arrays when data changes and keep IDs unique.

eventActivate returns the chosen event. slotSelect returns a civil date, time and timezone—not a reservation or timestamp. Your application must resolve daylight-saving gaps or repeated times and validate availability.

Keyboard and limitations

Use Tab and Shift+Tab between native controls; Enter or Space activates event and time buttons. Accessibility overview covers naming and focus responsibilities.

The default reactive editor and application-owned save/delete handler are covered in Editing. Custom and external forms are covered under Editing. UTC drag editing and typed recurrence examples are available under Editing and Recurring Events. The default editor supports explicit occurrence/series scope when series persistence is configured. See Views for calendar layouts and PDF Export for a downloadable agenda.

Scheduler overview