---
title: "Angular Timeline Cross-Instance Drag and Drop Example | Mobiscroll"
component: "Timeline"
framework: "Angular"
library_version: "6.2.0"
url: "https://demo.mobiscroll.com/angular/timeline/drag-drop-between-calendar-instances"
---

# Cross-Instance Drag and Drop - Angular Timeline demo

Drag and drop events between two Angular Timeline views to reassign resources or coordinate schedules — enable cross-timeline transfers.

- [Live demo](https://demo.mobiscroll.com/angular/timeline/drag-drop-between-calendar-instances)
- [View code on GitHub](https://github.com/acidb/mobiscroll-demos-angular/tree/main/src/demos/eventcalendar/timeline/drag-drop-between-calendar-instances)
- This demo in other frameworks: [JavaScript](https://demo.mobiscroll.com/timeline/drag-drop-between-calendar-instances.md), [jQuery](https://demo.mobiscroll.com/jquery/timeline/drag-drop-between-calendar-instances.md), [React](https://demo.mobiscroll.com/react/timeline/drag-drop-between-calendar-instances.md), [Vue](https://demo.mobiscroll.com/vue/timeline/drag-drop-between-calendar-instances.md)

## Description

There are certain cases when moving the events between calendars can come in handy.

Dragging and dropping events between two timeline instances can be enabled by turning on the [`externalDrag`](https://mobiscroll.com/docs/angular/eventcalendar/api#opt-externalDrag) and [`externalDrop`](https://mobiscroll.com/docs/angular/eventcalendar/api#opt-externalDrop) options.

**Want to learn about how you can configure the horizontal and vertical resolution?** [Check out how to build a synchronized flight scheduling dashboard →](https://demo.mobiscroll.com/angular/timeline/flight-scheduling-two-synchronized-timelines)

## What this demo shows

- Two separate monthly timeline instances are displayed one below the other, where days are arranged horizontally and resources are listed as rows on the left.
- **Header navigation** The month and year label opens date navigation, while the previous and next arrows move between weeks and the Today button returns to the current date.
- **Month view** The strip below the header show days of the selected month, with the current date highlighted.
- **Resources** Multiple resources are shown as separate timeline rows.
- **Event cards** Events are shown as colored cards with a left color stripe, a bold title, and the start and end time of the event below the title.
- **External drag and drop** Events can be dragged from one timeline instance and dropped into the other to move them between the two timelines.
- **Date positioning** Events are positioned by their assigned resource and exact date range.
- **Event interaction** Events highlight on hover and show drag and resize handles for repositioning or changing duration.
- **Event selection** Clicking an event selects and highlights it.
- **Event creation** New events can be created by double-clicking the timeline or by clicking and dragging across a time range.
- **Scrolling** The timeline supports horizontal and vertical scrolling for navigating through time and resources.

## Best for

- **Multi-timeline planning** Moving events between separate team, department, or location calendars.
- **Resource reassignment** Reassigning appointments, tasks, or shifts from one timeline to another with direct drag and drop.
- **Parallel timeline review** Comparing two weekly timelines and adjusting event placement between them.

## API used in this demo

- [`theme`](https://mobiscroll.com/docs/angular/eventcalendar/api#opt-theme) - option
- [`themeVariant`](https://mobiscroll.com/docs/angular/eventcalendar/api#opt-themeVariant) - option
- [`view`](https://mobiscroll.com/docs/angular/eventcalendar/api#opt-view) - option
- [`data`](https://mobiscroll.com/docs/angular/eventcalendar/api#opt-data) - option
- [`resources`](https://mobiscroll.com/docs/angular/eventcalendar/api#opt-resources) - option
- [`height`](https://mobiscroll.com/docs/angular/eventcalendar/api#opt-height) - option
- [`dragToMove`](https://mobiscroll.com/docs/angular/eventcalendar/api#opt-dragToMove) - option
- [`eventDelete`](https://mobiscroll.com/docs/angular/eventcalendar/api#opt-eventDelete) - option
- [`externalDrag`](https://mobiscroll.com/docs/angular/eventcalendar/api#opt-externalDrag) - option
- [`externalDrop`](https://mobiscroll.com/docs/angular/eventcalendar/api#opt-externalDrop) - option
- [`onEventCreated`](https://mobiscroll.com/docs/angular/eventcalendar/api#event-onEventCreated) - event

## Code

### Component

```ts
import { CommonModule } from '@angular/common';
import { Component } from '@angular/core';
import {
  MbscCalendarEvent,
  MbscEventcalendarView,
  MbscModule,
  MbscResource,
  Notifications,
  setOptions,
} from '@mobiscroll/angular';

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

@Component({
  selector: 'app-root', 
  templateUrl: './app.component.html',
  providers: [Notifications],
  standalone: true,
  imports: [CommonModule, MbscModule],
})
export class AppComponent {
  constructor(private notify: Notifications) {}

  myView: MbscEventcalendarView = {
    timeline: {
      type: 'month',
    },
  };

  firstEvents: MbscCalendarEvent[] = [
    {
      start: '2026-11-02T00:00',
      end: '2026-11-05T00:00',
      title: 'Event 1',
      color: '#166f6f',
      resource: 1,
    },
    {
      start: '2026-11-15T00:00',
      end: '2026-11-19T00:00',
      title: 'Event 2',
      color: '#e20000',
      resource: 1,
    },
    {
      start: '2026-11-10T00:00',
      end: '2026-11-14T00:00',
      title: 'Event 3',
      color: '#1dab2f',
      resource: 2,
    },
    {
      start: '2026-11-20T00:00',
      end: '2026-11-23T00:00',
      title: 'Event 4',
      color: '#e25dd2',
      resource: 2,
    },
    {
      start: '2026-11-03T00:00',
      end: '2026-11-10T00:00',
      title: 'Event 5',
      color: '#4418d2',
      resource: 3,
    },
    {
      start: '2026-11-16T00:00',
      end: '2026-11-19T00:00',
      title: 'Event 6',
      color: '#4981d6',
      resource: 3,
    },
    {
      start: '2026-11-08T00:00',
      end: '2026-11-12T00:00',
      title: 'Event 7',
      color: '#6e7f29',
      resource: 4,
    },
    {
      start: '2026-11-22T00:00',
      end: '2026-11-28T00:00',
      title: 'Event 8',
      color: '#8b8b00',
      resource: 4,
    },
    {
      start: '2026-11-02T00:00',
      end: '2026-11-07T00:00',
      title: 'Event 9',
      color: '#a32f00',
      resource: 5,
    },
    {
      start: '2026-11-18T00:00',
      end: '2026-11-23T00:00',
      title: 'Event 10',
      color: '#152d2b',
      resource: 5,
    },
  ];

  firstResources: MbscResource[] = [
    {
      id: 1,
      name: 'Resource A',
    },
    {
      id: 2,
      name: 'Resource B',
    },
    {
      id: 3,
      name: 'Resource C',
    },
    {
      id: 4,
      name: 'Resource D',
    },
    {
      id: 5,
      name: 'Resource E',
    },
  ];

  secondEvents: MbscCalendarEvent[] = [
    {
      start: '2026-11-05T00:00',
      end: '2026-11-09T00:00',
      title: 'Event 1',
      color: '#4418d2',
      resource: 1,
    },
    {
      start: '2026-11-16T00:00',
      end: '2026-11-20T00:00',
      title: 'Event 2',
      color: '#8b1a1a',
      resource: 1,
    },
    {
      start: '2026-11-08T00:00',
      end: '2026-11-11T00:00',
      title: 'Event 3',
      color: '#e7b300',
      resource: 2,
    },
    {
      start: '2026-11-22T00:00',
      end: '2026-11-25T00:00',
      title: 'Event 4',
      color: '#a32f00',
      resource: 2,
    },
    {
      start: '2026-11-12T00:00',
      end: '2026-11-17T00:00',
      title: 'Event 5',
      color: '#21a833',
      resource: 3,
    },
    {
      start: '2026-11-23T00:00',
      end: '2026-11-29T00:00',
      title: 'Event 6',
      color: '#a917bb',
      resource: 3,
    },
    {
      start: '2026-11-04T00:00',
      end: '2026-11-10T00:00',
      title: 'Event 7',
      color: '#e20000',
      resource: 4,
    },
    {
      start: '2026-11-18T00:00',
      end: '2026-11-25T00:00',
      title: 'Event 8',
      color: '#4981d6',
      resource: 4,
    },
    {
      start: '2026-11-07T00:00',
      end: '2026-11-12T00:00',
      title: 'Event 9',
      color: '#166f6f',
      resource: 5,
    },
    {
      start: '2026-11-20T00:00',
      end: '2026-11-27T00:00',
      title: 'Event 10',
      color: '#d6d145',
      resource: 5,
    },
  ];

  secondResources: MbscResource[] = [
    {
      id: 1,
      name: 'Resource A',
    },
    {
      id: 2,
      name: 'Resource B',
    },
    {
      id: 3,
      name: 'Resource C',
    },
    {
      id: 4,
      name: 'Resource D',
    },
    {
      id: 5,
      name: 'Resource E',
    },
  ];

  handleFirstCalEventCreated(args: any) {
    if (args.action === 'externalDrop') {
      this.notify.toast({
        context: '.md-drag-drop-first-calendar',
        message: 'Event dropped to Calendar 1',
      });
    }
  }

  handleSecondCalEventCreated(args: any) {
    if (args.action === 'externalDrop') {
      this.notify.toast({
        context: '.md-drag-drop-second-calendar',
        message: 'Event dropped to Calendar 2',
      });
    }
  }
}
```

### Template

```html
<div class="md-drag-drop-calendar">
  <div class="mbsc-form-group-title">Calendar 1</div>
  <mbsc-eventcalendar
    [view]="myView"
    [data]="firstEvents"
    [resources]="firstResources"
    [height]="420"
    [dragToMove]="true"
    [eventDelete]="true"
    [externalDrag]="true"
    [externalDrop]="true"
    (onEventCreated)="handleFirstCalEventCreated($event)"
    class="md-drag-drop-first-calendar"
  ></mbsc-eventcalendar>
  <div class="mbsc-form-group-title">Calendar 2</div>
  <mbsc-eventcalendar
    [view]="myView"
    [data]="secondEvents"
    [resources]="secondResources"
    [height]="420"
    [dragToMove]="true"
    [eventDelete]="true"
    [externalDrag]="true"
    [externalDrop]="true"
    (onEventCreated)="handleSecondCalEventCreated($event)"
    class="md-drag-drop-second-calendar"
  ></mbsc-eventcalendar>
</div>
```

## Implementation notes

- Render two independent `Eventcalendar` instances on the same page, each with `timeline: { type: 'month' }` and `height: 420`.
- Each instance has its own separate dataset: 5 resources (A-E) and 10 events with `dyndatetime` offsets spread across the current month.
- Enable on both instances: `dragToMove: true`, `eventDelete: true`, `externalDrag: true`, `externalDrop: true`. Both `externalDrag` and `externalDrop` must be set on both calendars to allow bidirectional transfer - `externalDrag` permits dragging an event out, `externalDrop` permits receiving a drop from another instance.
- Handle `onEventCreated` on each instance. Inside the handler, check `args.action === 'externalDrop'` to distinguish a cross-calendar drop from a regular click-to-create or drag-to-create. When the condition is true, show a `Toast` confirming which calendar received the event.
- Scope each `Toast` to its calendar using the `context` prop (a CSS class or element selector pointing to the receiving calendar's wrapper). This positions the toast near the correct calendar rather than at the page level.

## 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: [Drag & Drop Restrictions per Event & Resource](https://demo.mobiscroll.com/angular/timeline/conditional-move-resize-drag-drop-fixed-event-length-fixed-to-resource.md) - Restrict drag, move, and resize on an Angular Timeline per event, resource, or globally — lock events in time, fix length, or prevent resource switches.
- Next: [Prevent Event Overlap](https://demo.mobiscroll.com/angular/timeline/prevent-double-booking-events.md) - Prevent double booking on the Angular Timeline — block overlaps per event, per resource, or globally, and show a toast on conflict.
