When I affect a function and call it, the variable this is undefine, so the this.http.get...  is in error ERROR TypeError: Cannot read property 'http' of undefined
const getFacilityEventsFunction = this.isPastActivated
      ? this.facilityService.getPastTimelineFacilities
      : this.facilityService.getFutureTimelineFacilities;
    this.facilityEvents$ = getFacilityEventsFunction(this.iteration);
Also, when I remove the logic with the function in a const and do a call with a classic if else, it works
if (this.isPastActivated) {
  this.facilityEvents$ = this.facilityService.getPastTimelineFacilities(0);
} else {
  this.facilityEvents$ = this.facilityService.getFutureTimelineFacilities(0);
}
 
    