Currently, I'm facing a challenge with performing multiple GET requests using Angular2 within a Django/Python environment.
After successfully making an API request and retrieving a list of users to determine the current user's ID, I utilize a .flatMap
operation for a subsequent request to fetch all comments. By comparing the userId to the comment list, I filter out only the comments made by the user. All obtained data is in JSON format.
At this stage, my goal is to retrieve the Article related to each comment. However, when attempting to run a function within a loop to fetch data, the request doesn't seem to be executed at all.
Here's the code snippet of the service:
import {Injectable} from "angular2/core";
import {Http, Headers, Response} from "angular2/http";
import 'rxjs/Rx';
import {Observable} from "rxjs/Observable";
@Injectable()
export class DataService {
// Implementation logic goes here
}
Below is the app.component segment:
import {Component, OnInit} from 'angular2/core';
import {DataService} from './data.service.ts';
@Component({
selector: 'http-app',
template: `
<!-- Template content goes here -->
`,
providers: [DataService]
})
export class AppComponent{
// Component implementation details go here
}
If you have any insights or suggestions regarding why the requests are not being processed as intended, kindly share your thoughts.