# AngularJS Event Calendar (Controller As) | DayPilot Pro for JavaScript Demo

> Read more about the [AngularJS event calendar](https://doc.daypilot.org/calendar/angularjs/) plugin.

## Links

- Canonical HTML: /demo/calendar/angularjsctrlas.html
- Source HTML folder: /demo/calendar/
- Catalog root: /demo/
- Catalog: /demo/llms.txt

## Source

### Inline demo script 1

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

            this.config = {
                startDate: "2026-09-01",
                viewType: "Week"
            };

            this.events = [
                {
                    start: new DayPilot.Date("2026-09-01T10:00:00"),
                    end: new DayPilot.Date("2026-09-01T14:00:00"),
                    id: DayPilot.guid(),
                    text: "First Event"
                }
            ];

            this.add = function () {
                this.events.push(
                    {
                        start: new DayPilot.Date("2026-09-01T10:00:00"),
                        end: new DayPilot.Date("2026-09-01T12:00:00"),
                        id: DayPilot.guid(),
                        text: "Simple Event"
                    }
                );
            };

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

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

            this.message = function () {
                this.calendar.message("Hi");
            };

            this.day = function () {
                this.config.viewType = "Day";
            };

            this.week = function () {
                this.config.viewType = "Week";
                this.calendar.update();
            };

        });
```

