Articles in this section

How to display specific field on appointments based on a condition?

This article explains the way to display the time field in an appointment based on a condition in Angular Scheduler.

 

Step 1: Bind the eventTemplate to change the default appointment template, as shown in the following code example.

<ng-template #eventTemplate let-data>

    <div class='template-wrap'>

        <div class="subject">{{data.Subject}}</div>

        <div *ngIf="data.IsAllDay" class="time">{{getTimeString(data.StartTime)}} -

            {{getTimeString(data.EndTime)}}</div>

    </div>

</ng-template>


Appointment template: https://ej2.syncfusion.com/angular/documentation/api/schedule/viewsModel/#eventtemplate

 

Step 2: Add the getTimeString method to retrieve the startTime and endTime in the app.component.ts file.

private instance: Internationalization = new Internationalization();

getTimeString(value: Date)string {

  return this.instance.formatDate(value, { skeleton: 'hm' });

} 

Step 3: Add the below data source in the data.ts file.

export let resourceDataObject[] = [

    {

        Id1,

        Subject'Testing-1',

        StartTimenew Date(20183710),

        EndTimenew Date(20183712),

        IsAllDayfalse,

        IsReadonlytrue,

        TaskId2

    }, {

        Id2,

        Subject'Testing-2',

        StartTimenew Date(2018310),

        EndTimenew Date(2018310),

        IsAllDaytrue,

        IsReadonlytrue,

        TaskId2

    }

];

Step 4: Run the sample, the time field will be rendered in the appointments when the appointment is an all-day appointment as shown below.

output


Refer to the example from the following GitHub link.

Example – Scheduler with appointment template

 

Conclusion


We hope you enjoyed learning about how to display specific field on appointments based on a condition.

You can refer to our Angular Scheduler feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our Angular Scheduler example to understand how to create and manipulate data.

For current customers, you can check out our Document Processing Libraries from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsBoldDesk Support, or feedback portal. We are always happy to assist you!

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied