Error when run a http.get multiples times – Cannot read property ‘get’ of undefined – Angular

My projet is used to receive data from an API in real time. The data is on API and I collect variables by using a .CSV file on the web server of a S7-1500 Siemens.

So, to receive data in real time, I want to make a setInterval in my service to run this function more than one time.

At the first loop, the API call works, but the second time it loops, I have this error:

Type Error: Cannot read 'get' of undefined 
at line.service.ts 
at Array.map(<anonymous>) 
at getData(line.service.ts:25).

The second time, I have a problem with http.get, but I don’t find how to resolve that after lot of searches.

The code :

import {BehaviorSubject, combineLatest, Subject, Subscription} from 'rxjs';
import {HttpClient, HttpHeaders} from '@angular/common/http';
import {Injectable, OnDestroy} from '@angular/core';

@Injectable()
export class LineService{
  constructor(private http: HttpClient) {
    this.getData();
    setInterval(this.getData, 5000);
  }

  lineSubject = new BehaviorSubject<RcvData[]>([]);

  getData(): void {
    console.log('One Loop');
    const lists: string[] = [
      'assets/donnee-l1.csv',
      'assets/donnee-l2.csv',
      'assets/donnee-l3.csv',
      'assets/donnee-l4.csv',
      'assets/donnee-l5.csv',
      'https://192.168.0.2/DataLogs?Path=/DataLogs/MyDataLog7.csv&Action=DOWNLOAD&E=1'
    ];
    console.log(lists);
    combineLatest(lists.map(list => this.http.get(list, {responseType: 'text'})))
      .subscribe(listResults => {

        console.log(listResults);
        const parsedListResults = listResults.map(data => {
          const csvToRowArray = data.split('n');
          const lastRow = csvToRowArray[csvToRowArray.length - 2];
          const row = lastRow.split(',');
          return new RcvData(
            parseInt(row[0], 10),
            row[1], row[2],parseInt(row[3], 10), row[4], row[5], row[6], row[7],
            parseInt(row[8], 10),
            parseInt(row[9], 10),
            parseInt(row[10], 10),
            parseInt(row[11], 10),
            parseFloat(row[12]),
            parseFloat(row[13]),
            parseFloat(row[14]),
            parseFloat(row[15]),
            parseFloat(row[16]),
            parseInt(row[17], 10))
        });
        this.lineSubject.next(parsedListResults);
        console.log(this.lineSubject);
      });
  }
}


class RcvData{
  seqNo: number;
  date: string;
  utcTime: string;
  id: number;
  name: string;
  refCharge: string;
  refDecharge: string;
  quantiteEnCours: string;
  quantiteHoraireReel: number;
  quantiteHoraireTheorique: number;
  quantitePosteReel: number;
  quantitePosteTheorique: number;
  trpHeureReel: number;
  trpPosteReel: number;
  trpObjectif: number;
  consoAir: number;
  consoElec: number;
  status: number;


  constructor(
    seqNo: number,
    date: string,
    utcTime: string,
    id: number,
    name: string,
    refCharge: string,
    refDecharge: string,
    quantiteEnCours: string,
    quantiteHoraireReel: number,
    quantiteHoraireTheorique: number,
    quantitePosteReel: number,
    quantitePosteTheorique: number,
    trpHeureReel: number,
    trpPosteReel: number,
    trpObjectif: number,
    consoAir: number,
    consoElec: number,
    status: number)
  {
    this.seqNo = seqNo;
    this.date = date.replace(/ /g, '').replace(/"/g, '');
    this.utcTime = utcTime.replace(/ /g, '').replace(/"/g, '');
    this.id = id;
    this.name = name.replace(/"/g, '');
    this.refCharge = refCharge.replace(/ /g, '').replace(/"/g, '');
    this.refDecharge = refDecharge.replace(/ /g, '').replace(/"/g, '');
    this.quantiteEnCours = quantiteEnCours.replace(/ /g, '').replace(/"/g, '');
    this.quantiteHoraireReel = quantiteHoraireReel;
    this.quantiteHoraireTheorique = quantiteHoraireTheorique;
    this.quantitePosteReel = quantitePosteReel;
    this.quantitePosteTheorique = quantitePosteTheorique;
    this.trpHeureReel = trpHeureReel;
    this.trpPosteReel = trpPosteReel;
    this.trpObjectif = trpObjectif;
    this.consoAir = consoAir;
    this.consoElec = consoElec;
    this.status = status;
  }
}

Every answer is welcome, thanks a lot !

Source: Angular Questions