

console.log(this.scheduleObj.getOccurrencesByID(this.scheduleObj.eventsData[0].Id));
Also how can I retrieve the occurences from another component?For example in my invoice.component.ts i have following code:getAppointments(){
this.invoiceService.getAppointments().subscribe((data : any) => {
this.appointments= data.appointment;
});
};in my server/invoice router:router.get("/getAppointments", authRequired, (req, res) => {
User.findOne({_id: req.decoded.userId}).select('username email').exec((err, user) =>{
if(err){
res.json({success: false, message: err});
} if(!user){
res.json({success: false, message: 'User not found'});
} else {
user = user;
var query = {CreatedBy: user.username};
connection.db.collection('ScheduleData').find(query).toArray((err, cus) => {
res.json({appointment: cus});
console.log(req.body.params);
});
}
});
});This gives me a JSON object (an array) of all the appointments. So how do i apply the GetOccurencesById() to all the appointments which has RecurrenceRule != null?So like this:this.appointments.forEach(detail => {
if(detail.RecurrenceRule != null) {console.log(detail.getOccurrencesByID(detail.id));}}but this isnt working, i get: TypeError: detail.getOccurrencesByID is not a function
this.service.getAppointments().subscribe((data : any) => {
this.appointments = data.appointment;
console.log(this.appointments); //gives me an array of 16 appointments
console.log( this.scheduleObj.getOccurrencesByID((this.appointments[0] as any).Id)); //empty array, here I want the occurences of the reoccuring event
});
However, I only get an empty array. What am i overlooking here?If you need more code, please let me know.Thanks in advance