src/providers/calendarEventTitle.provider.ts
This class is responsible for displaying all event titles within the calendar. You may override any of its methods via angulars DI to suit your requirements. For example:
import { CalendarEventTitleFormatter, CalendarEvent } from 'angular-calendar';
class CustomEventTitleFormatter extends CalendarEventTitleFormatter {
month(event: CalendarEvent): string {
return `Custom prefix: ${event.title}`;
}
}
// in your component
providers: [{
provide: CalendarEventTitleFormatter,
useClass: CustomEventTitleFormatter
}]
month |
month(event: any)
|
The month view event title.
Returns:
string
|
monthTooltip |
monthTooltip(event: any)
|
The month view event tooltip. Return a falsey value from this to disable the tooltip.
Returns:
string
|
week |
week(event: any)
|
The week view event title.
Returns:
string
|
weekTooltip |
weekTooltip(event: any)
|
The week view event tooltip. Return a falsey value from this to disable the tooltip.
Returns:
string
|
day |
day(event: any)
|
The day view event title.
Returns:
string
|
dayTooltip |
dayTooltip(event: any)
|
The day view event tooltip. Return a falsey value from this to disable the tooltip.
Returns:
string
|
import { CalendarEvent } from 'calendar-utils';
/**
* This class is responsible for displaying all event titles within the calendar. You may override any of its methods via angulars DI to suit your requirements. For example:
*
* ```
* import { CalendarEventTitleFormatter, CalendarEvent } from 'angular-calendar';
*
* class CustomEventTitleFormatter extends CalendarEventTitleFormatter {
*
* month(event: CalendarEvent): string {
* return `Custom prefix: ${event.title}`;
* }
*
* }
*
* // in your component
* providers: [{
* provide: CalendarEventTitleFormatter,
* useClass: CustomEventTitleFormatter
* }]
* ```
*/
export class CalendarEventTitleFormatter {
/**
* The month view event title.
*/
month(event: CalendarEvent): string {
return event.title;
}
/**
* The month view event tooltip. Return a falsey value from this to disable the tooltip.
*/
monthTooltip(event: CalendarEvent): string {
return event.title;
}
/**
* The week view event title.
*/
week(event: CalendarEvent): string {
return event.title;
}
/**
* The week view event tooltip. Return a falsey value from this to disable the tooltip.
*/
weekTooltip(event: CalendarEvent): string {
return event.title;
}
/**
* The day view event title.
*/
day(event: CalendarEvent): string {
return event.title;
}
/**
* The day view event tooltip. Return a falsey value from this to disable the tooltip.
*/
dayTooltip(event: CalendarEvent): string {
return event.title;
}
}