Agent-readable demo data

Title
Scheduler and AngularJS (controllerAs) | DayPilot Pro for JavaScript Demo
Tree
DayPilot JavaScript Demo
Catalog root
Default
Description
Read more about the AngularJS Scheduler.

Inline demo script 1

var app = angular.module('main', ['daypilot']).controller('SchedulerCtrl', function () {

            var ctrl = this;

            this.onEventSelected = function (args) {
                ctrl.selectedEvents = ctrl.scheduler.multiselect.events();
            };

            this.onEventMoved = function (args) {
                ctrl.scheduler.message("Event moved: " + args.e.text());
            };

            this.config = {
                scale: "Day",
                days: 365,
                bubble: new DayPilot.Bubble(),
                startDate: "2026-09-01",
                eventClickHandling: "Select",
                timeHeaders: [
                    {groupBy: "Month"},
                    {groupBy: "Cell", format: "d"}
                ],
                resources: [
                    {name: "Room B", id: "B"},
                    {name: "Room C", id: "C"},
                    {name: "Room D", id: "D"},
                    {name: "Room E", id: "E"}
                ]
            };

            this.events = [
                {
                    start: new DayPilot.Date("2026-09-05T00:00:00"),
                    end: new DayPilot.Date("2026-09-06T00:00:00"),
                    id: DayPilot.guid(),
                    resource: "B",
                    text: "One-Day Event",
                    bubbleHtml: "Details"
                }
            ];

            this.add = function () {
                this.events.push(
                    {
                        start: new DayPilot.Date("2026-09-05T00:00:00"),
                        end: new DayPilot.Date("2026-09-06T00:00:00"),
                        id: DayPilot.guid(),
                        resource: "B",
                        text: "One-Day Event",
                        bubbleHtml: "Details"
                    }
                );
            };

            this.move = function () {
                var event = this.events[0];
                if (event) {
                    event.start = event.start.addDays(1);
                    event.end = event.end.addDays(1);
                }
            };

            this.rename = function () {
                this.events[0].text = "New name";
            };

            this.scrollTo = function (date) {
                this.scheduler.scrollTo(date);
            };

            this.scale = function (val) {
                this.config.scale = val;
            };

        });