We are doing some prototype testing where we take a json which has around 28000 records via http. We convert it to an instance of a class in Typescript and add it to an existing array.
The array is then bind to the view which re and displays the list.
this.http.get("http://localhost:8100/list.son")
            .map((res) => res.json())
            .flatMap((array, index) => array).
            .subscribe((value:any) => {
                    console.log("RENDERING");
                    this.list.push(new Element(8, value.name, value.number));
                  });
The problem is that the flatmap seems to be passing in elements of the array one by one to the subscribe function synchronously (tried using a set timeout before the http call which only ran after the subscribe). Therefore it is a sort of a loop of 28000 elements which hangs the UI thread. How could we trigger subscribe on an interval basis so that the UI thread can get some time during the processing of the list elements. (Essentially pseudo async recursion).
EDIT : Updated code with Meir's answer
Here is the code that I have currently, additionally I believe map is the wrong operation since it outputs the number of inputs it takes in. So correct me if I am wrong it takes in one http response and outputs one array, and therefore this array is processed as a whole by the rest of the steps. Additionally I have provided the sample list.json.
this.http.get("http://localhost:8100/list.json")
                .map((res) => {
                  console.log(res.json().list);
                  return res.json().list
                })
                .delayWhen((v) => Observable.timer(50))
                .buffer(Observable.timer(50, 50))
                .subscribe((entry) => {
                  console.log("CAME HERE AA " + entry);
                });
LIST JSON, there are more entries but I just kept it at two here
{ "list" : [
  {
    "name" : "test",
    "number" : "that",
    "verificationId" : 78
  },
  {
    "name" : "test",
    "number" : "that",
    "verificationId" : 78
  },
  {
    "name" : "test",
    "number" : "that",
    "verificationId" : 78
  },
  {
    "name" : "test",
    "number" : "that",
    "verificationId" : 78
  }]
}