Day/Week View Switcher
Usage
theme: 'ios' You can turn auto theming on and let it decide based on the platform.
Usage
themeVariant: 'light' You can turn auto dark mode on based on system settings.
Usage
clickToCreate: true,
// click to create is on dragToCreate: true,
// drag to create is on dragToMove: true,
// reordering is on dragToResize: true,
// resizing is on eventDelete: true
// deleting is on Fine-tune drag & drop with these options, which are false by default.
Usage
locale: localeEn Selecting the locale loads the localized settings and the translated UI text.
Day/Week View Switcher
Scheduling people, teams or an entire workforce requires different views. Sometimes you'll be needing a helicopter view of a week and other times you might want to dig into a specific day. This all can be served through a simple switching mechanism implemented with a segmented control right in the header of the calendar.
By dynamically changing the options you can set the level of detail you want to see. Eg. Show a daily timeline with hourly steps, show the work week with the same resolution or zoom out for a full week-view with 12 hour steps.
Demo

Code
import { CommonModule } from '@angular/common';
import { HttpClient } from '@angular/common/http';
import { Component, OnInit } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { MbscCalendarEvent, MbscEventcalendarView, MbscModule, Notifications, setOptions } from '@mobiscroll/angular';
setOptions({
locale: ,
theme: ' ',
themeVariant: ' '
});
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
providers: [Notifications],
standalone: true,
imports: [CommonModule, FormsModule, MbscModule],
})
export class AppComponent implements OnInit {
constructor(
private http: HttpClient,
private notify: Notifications,
) {}
myEvents: MbscCalendarEvent[] = [];
view = 'week';
calView: MbscEventcalendarView = {
timeline: {
type: 'week',
},
};
myResources = [
{
id: 1,
name: 'Ryan',
color: '#ff0101',
title: 'Cloud System Engineer',
img: 'https://img.mobiscroll.com/demos/m1.png',
},
{
id: 2,
name: 'Kate',
color: '#239a21',
title: 'Help Desk Specialist',
img: 'https://img.mobiscroll.com/demos/f1.png',
},
{
id: 3,
name: 'John',
color: '#8f1ed6',
title: 'Application Developer',
img: 'https://img.mobiscroll.com/demos/m2.png',
},
{
id: 4,
name: 'Mark',
color: '#01adff',
title: 'Network Administrator',
img: 'https://img.mobiscroll.com/demos/m3.png',
},
{
id: 5,
name: 'Sharon',
color: '#d8ca1a',
title: 'Data Quality Manager',
img: 'https://img.mobiscroll.com/demos/f2.png',
},
];
myInvalids = [
{
start: '00:00',
end: '06:00',
recurring: {
repeat: 'weekly',
weekDays: 'MO,TU,WE,TH,FR',
},
},
{
start: '20:00',
end: '23:59',
recurring: {
repeat: 'weekly',
weekDays: 'MO,TU,WE,TH,FR',
},
},
{
recurring: {
repeat: 'weekly',
weekDays: 'SA,SU',
},
},
];
ngOnInit(): void {
this.http.jsonp<MbscCalendarEvent[]>('https://trial.mobiscroll.com/timeline-events/', 'callback').subscribe((resp) => {
this.myEvents = resp;
});
}
changeView(): void {
setTimeout(() => {
switch (this.view) {
case 'day':
this.calView = {
timeline: { type: 'day' },
};
break;
case 'workweek':
this.calView = {
timeline: {
type: 'week',
startDay: 1,
endDay: 5,
},
};
break;
case 'week':
this.calView = {
timeline: {
type: 'week',
},
};
break;
}
});
}
eventUpdateFail(): void {
this.notify.toast({
message: "Can't schedule outside of working hours",
});
}
}
<div class="md-switching-timeline-view-cont">
<mbsc-eventcalendar
[data]="myEvents"
[view]="calView"
[resources]="myResources"
[invalid]="myInvalids"
[headerTemplate]="myHeaderTemplate"
[resourceTemplate]="myResourceTemplate"
(onEventCreateFailed)="eventUpdateFail()"
(onEventUpdateFailed)="eventUpdateFail()"
>
<ng-template #myHeaderTemplate>
<mbsc-calendar-nav class="md-work-week-nav"></mbsc-calendar-nav>
<div class="md-work-week-picker">
<mbsc-segmented-group [(ngModel)]="view" (change)="changeView()">
<mbsc-segmented value="day">Day</mbsc-segmented>
<mbsc-segmented value="workweek">Work week</mbsc-segmented>
<mbsc-segmented value="week">Week</mbsc-segmented>
</mbsc-segmented-group>
</div>
<mbsc-calendar-prev class="md-work-week-prev"></mbsc-calendar-prev>
<mbsc-calendar-today class="md-work-week-today"></mbsc-calendar-today>
<mbsc-calendar-next class="md-work-week-next"></mbsc-calendar-next>
</ng-template>
</mbsc-eventcalendar>
<ng-template #myResourceTemplate let-resource>
<div class="md-work-week-cont">
<div class="md-work-week-name">{{resource.name}}</div>
<div class="md-work-week-title">{{resource.title}}</div>
<img class="md-work-week-avatar" [attr.alt]="resource.name" [src]="resource.img" />
</div>
</ng-template>
</div>
.md-work-week-cont {
position: relative;
padding-left: 50px;
}
.md-work-week-avatar {
position: absolute;
max-height: 50px;
max-width: 50px;
top: 21px;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
left: 20px;
}
.md-work-week-name {
font-size: 16px;
}
.md-work-week-title {
font-size: 12px;
margin-top: 5px;
}
.md-switching-timeline-view-cont .mbsc-segmented {
max-width: 350px;
margin: 0 auto;
padding: 1px;
}
.md-work-week-picker {
flex: 1 0 auto;
}
.md-work-week-nav {
width: 200px;
}
.md-switching-timeline-view-cont .mbsc-timeline-resource {
display: flex;
align-items: center;
}
.md-switching-timeline-view-cont .mbsc-timeline-resource-col {
width: 205px;
}
/* material header order */
.mbsc-material.md-work-week-prev {
order: 1;
}
.mbsc-material.md-work-week-next {
order: 2;
}
.mbsc-material.md-work-week-nav {
order: 3;
}
.mbsc-material .md-work-week-picker {
order: 4;
}
.mbsc-material .md-work-week-today {
order: 5;
}
/* windows header order */
.mbsc-windows.md-work-week-nav {
order: 1;
}
.mbsc-windows.md-work-week-prev {
order: 2;
}
.mbsc-windows.md-work-week-next {
order: 3;
}
.mbsc-windows .md-work-week-picker {
order: 4;
}
.mbsc-windows .md-work-week-today {
order: 5;
}