Good day,
I’m currently building an ionic app and making use of the Ionic Native Calendar plugin. I want to use this plugin to be able to dynamically change the calendar event parameters associated with it via JSON linked to a Firebase database and not set these in-app as per the demo (as my calendar events will always change). The calendar parameters you can set include, strings and a start and end date, which leads me to believe that this might be possible to achieve?
I currently have the app working fine using the method below, as per the documentation, but this method does not allow me to update the data dynamically as I have to put the calendar parameters in the app, specifically in the home.ts file, as per my current situation now…
In my home.html
file I have a button that once clicked should create a calendar event:
<button ion-button (click)="createEvent()">Add to Calendar</button>
In my home.ts
file I have the following function set:
createEvent() {
this.calendar.createEvent('Easter Celebration', 'myChurch', 'Be there or be square', new Date(2017, 9, 20, 13, 0, 0, 0),
new Date(2017, 9, 20, 14, 0, 0, 0)).then(() => {
console.log('Event Created!');
}).catch((err) => {
console.log('Oops, something went wrong:', err);
});
}
The problem is that, I cannot dynamically change the calendar values using the method above. I would like to know how I can possibly achieve the same by having the values being called from a JSON file rather than me having to have them in the app as per my example. I already have a JSON file controlling other data dynamically in my app, so I would like to then be able to add the calendar values to this too.