---
title: "Angular Range Range Picker for Event Creation Example | Mobiscroll"
component: "Range"
framework: "Angular"
library_version: "6.1.5"
url: "https://demo.mobiscroll.com/angular/range/adding-event-start-end"
---

# Range Picker for Event Creation - Angular Range demo

Add a date range picker to event creation forms — switch between date-only and date+time modes with an all-day toggle for start and end date selection.

- [Live demo](https://demo.mobiscroll.com/angular/range/adding-event-start-end)
- [View code on GitHub](https://github.com/acidb/mobiscroll-demos-angular/tree/main/src/demos/datepicker/range/adding-event-start-end)
- This demo in other frameworks: [JavaScript](https://demo.mobiscroll.com/javascript/range/adding-event-start-end.md), [jQuery](https://demo.mobiscroll.com/jquery/range/adding-event-start-end.md), [React](https://demo.mobiscroll.com/react/range/adding-event-start-end.md), [Vue](https://demo.mobiscroll.com/vue/range/adding-event-start-end.md)

## Description

Use the range picker for a new event creation. Let people pick start and end dates when adding events.

Dynamically switch between date only and date-time entry based on an "all-day" switch by changing the `controls` to `'date'` or `'datetime'`.

**Interested in an event calendar solution?** [Check out the event calendar →](https://demo.mobiscroll.com/angular/eventcalendar)

## What this demo shows

- Shows a mobile form for creating and editing calendar events with a date range picker.
- **Event details** Fields for the title, location, all-day status, start and end date and time, availability, and notes.
- **Initial values** The editor can open with predefined start and end values or empty date fields for the user to complete.
- **All-day events** A toggle switches between timed and all-day events, changing the picker controls from date and time to date only.
- **Availability** A segmented control sets the event status to busy or free.
- **Date and time selection** Selecting the start or end field opens a wheel-style picker optimized for touch interaction.
- **Range editing** The start and end values can be edited independently while both remain visible in the picker for context.
- **Picker actions** Cancel discards date and time changes, while Set confirms them.

## Best for

- **Calendar event creation** Mobile forms for adding or updating calendar events.
- **Appointment scheduling** Editors that collect event details, date ranges, and availability.
- **Meeting editors** Workflows for switching between timed and all-day meetings.

## Tutorial

```html
<mbsc-input label="Title" placeholder="Name of the event"></mbsc-input>
<mbsc-input label="Location" placeholder="Where will it be?"></mbsc-input>
<mbsc-switch label="All day" [(ngModel)]="allDay" (change)="allDayChange()"></mbsc-switch>
<mbsc-datepicker [controls]="controls" select="range" [startInput]="start" [endInput]="end"></mbsc-datepicker>
<mbsc-input #start label="Start" placeholder="Start event"></mbsc-input>
<mbsc-input #end label="End" placeholder="End event"></mbsc-input>
<mbsc-segmented-group [(ngModel)]="showAs">
    <mbsc-segmented value="busy">Show as busy</mbsc-segmented>
    <mbsc-segmented value="free">Show as free</mbsc-segmented>
</mbsc-segmented-group>
<mbsc-textarea label="Notes" placeholder="Enter notes, URL, comments"></mbsc-textarea>
```

```ts
allDay = false;
showAs = 'busy';
controls = ['datetime'];

allDayChange() {
    this.controls = this.allDay ? ['date'] : ['datetime'];
};
```

## API used in this demo

- [`theme`](https://mobiscroll.com/docs/angular/datepicker/api#opt-theme) - option
- [`themeVariant`](https://mobiscroll.com/docs/angular/datepicker/api#opt-themeVariant) - option
- [`controls`](https://mobiscroll.com/docs/angular/datepicker/api#opt-controls) - option
- [`select`](https://mobiscroll.com/docs/angular/datepicker/api#opt-select) - option
- [`startInput`](https://mobiscroll.com/docs/angular/datepicker/api#opt-startInput) - option
- [`endInput`](https://mobiscroll.com/docs/angular/datepicker/api#opt-endInput) - option

## Code

### Component

```ts
import { CommonModule } from '@angular/common';
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { MbscModule, setOptions } from '@mobiscroll/angular';

setOptions({
  theme: 'ios',
  themeVariant: 'light'
});

@Component({
  selector: 'app-root', 
  templateUrl: './app.component.html',
  standalone: true,
  imports: [CommonModule, FormsModule, MbscModule],
})
export class AppComponent {
  allDay = false;
  showAs = 'busy';
  controls = ['datetime'];

  allDayChange(): void {
    this.controls = this.allDay ? ['date'] : ['datetime'];
  }
}
```

### Template

```html
<mbsc-page>
  <mbsc-input label="Title" placeholder="Name of the event"></mbsc-input>
  <mbsc-input label="Location" placeholder="Where will it be?"></mbsc-input>
  <mbsc-switch label="All day" [(ngModel)]="allDay" (change)="allDayChange()"></mbsc-switch>
  <mbsc-datepicker [controls]="controls" select="range" [startInput]="start" [endInput]="end"></mbsc-datepicker>
  <mbsc-input #start label="Start" placeholder="Start event"></mbsc-input>
  <mbsc-input #end label="End" placeholder="End event"></mbsc-input>
  <mbsc-segmented-group [(ngModel)]="showAs">
    <mbsc-segmented value="busy">Show as busy</mbsc-segmented>
    <mbsc-segmented value="free">Show as free</mbsc-segmented>
  </mbsc-segmented-group>
  <mbsc-textarea label="Notes" placeholder="Enter notes, URL, comments"></mbsc-textarea>
</mbsc-page>
```

## Implementation notes

- Set `select: 'range'` with `controls: ['datetime']` (or `['date']` for all-day) on a single `Datepicker` instance to collect a start and end date/time pair.
- Bind the picker to two separate fields via `startInput`/`endInput` instead of a single value input: React/Vue pass input element refs, Angular passes template reference variables through `[startInput]`/`[endInput]`, and JS/jQuery pass CSS selector strings (e.g. `'#start'`, `'#end'`).
- Toggling an "all-day" control switches `controls` between `['date']` and `['datetime']` at runtime: JS/jQuery call `.setOptions({ controls: [control] })` on the picker instance; React recomputes the `controls` prop from state; Angular/Vue update the bound `controls` array reactively.
- The picker only manages the date/time range itself - title, location, busy/free, and notes are ordinary form fields with no picker-option equivalent.

## Run it in your project

1. If not signed up yet, or don't own a license, you can [start a free trial](https://mobiscroll.com/starttrial).

2. Clone the repository:

   ```
   git clone https://github.com/acidb/mobiscroll-demos-angular.git
   ```

3. If not installed yet, install the Mobiscroll CLI from NPM:

   ```
   npm install -g @mobiscroll/cli
   ```

4. Config Mobiscroll - open a terminal window in the root directory and run:

   ```
   mobiscroll config angular
   ```

5. Install dependencies - open a terminal window in the root directory and run:

   ```
   npm install
   ```

6. Run the project:

   ```
   ng serve
   ```

On a trial, add `--trial` to the config command: `mobiscroll config angular --trial`.

Running a demo locally requires a Mobiscroll trial or a license; setup is per framework at https://mobiscroll.com/docs/angular/getting-started/installation

## Related demos

- Previous: [Rental Availability](https://demo.mobiscroll.com/angular/range/book-rental-months-ahead.md) - Build a vacation rental availability calendar with the Angular date range picker — multi-month view with automatic booking validation.
