Angular-calendar: How do I include the default openDayEventsTemplate while having my custom openDayEventsTemplate?

Created on 31 Oct 2017  路  2Comments  路  Source: mattlewis92/angular-calendar

After going through the documentations, I have the following unsolved questions:

  1. How do I include the default openDayEventsTemplate (which shows the details about the events in a list) into my own custom openDayEventsTemplate component?
  2. How do I access the event objects in my own custom openDayEventsTemplate component?

"Issues" is probably not the place to go for this post but sorry that I can't find a more fitting place.

Thanks a lot.

Most helpful comment

The only way to do this is to copy the markup in your template and adapt as appropriate. You can use this as a starter:

<ng-template
      #openDayEventsTemplate
      let-events="events"
      let-eventClicked="eventClicked">
      <div
        *ngFor="let event of events"
        [ngClass]="event?.cssClass"
        mwlDraggable
        [dropData]="{event: event}"
        [dragAxis]="{x: event.draggable, y: event.draggable}">
        <span
          class="cal-event"
          [style.backgroundColor]="event.color.primary">
        </span>
        <mwl-calendar-event-title
          [event]="event"
          [customTemplate]="eventTitleTemplate"
          view="month"
          (mwlClick)="eventClicked.emit({event: event})">
        </mwl-calendar-event-title>
        <mwl-calendar-event-actions [event]="event"></mwl-calendar-event-actions>
      </div>
    </ng-template>

All 2 comments

You need to use 'openDayEventsTemplate' input() property which will accept template reference as parameter.

Here is the code:

`
[activeDayIsOpen]="true" (eventClicked)="handleEvent('Clicked', $event.event)"
[openDayEventsTemplate]="openDayEventsTemplate">

Display day events details `

The only way to do this is to copy the markup in your template and adapt as appropriate. You can use this as a starter:

<ng-template
      #openDayEventsTemplate
      let-events="events"
      let-eventClicked="eventClicked">
      <div
        *ngFor="let event of events"
        [ngClass]="event?.cssClass"
        mwlDraggable
        [dropData]="{event: event}"
        [dragAxis]="{x: event.draggable, y: event.draggable}">
        <span
          class="cal-event"
          [style.backgroundColor]="event.color.primary">
        </span>
        <mwl-calendar-event-title
          [event]="event"
          [customTemplate]="eventTitleTemplate"
          view="month"
          (mwlClick)="eventClicked.emit({event: event})">
        </mwl-calendar-event-title>
        <mwl-calendar-event-actions [event]="event"></mwl-calendar-event-actions>
      </div>
    </ng-template>
Was this page helpful?
0 / 5 - 0 ratings

Related issues

nguyendo picture nguyendo  路  3Comments

mattlewis92 picture mattlewis92  路  3Comments

oldschoolbg picture oldschoolbg  路  4Comments

Sushma-tiwari picture Sushma-tiwari  路  3Comments

teodoramalec picture teodoramalec  路  4Comments