Boris Lapouchner Boris Lapouchner - 1 month ago 21
TypeScript Question

Angular2 Get Request is made twice

I have a problem where Angular2 makes the same request twice. I don't know why, though, because I have only one time a subscribe on the Observable. Here is my code:

My service looks like this:

getProjects(): Observable<Project[]> {
return this.http.get(this.url)

private mapProjects(response: Response): any {
const mappedProjects = response.json();
return mappedProjects;

My component looks like this:

export class ProjectListComponent implements OnInit {

// List of projects
listProjects: Project[] = [];

constructor(private projectListService: ProjectListService) {

public getProjectList() {
projects => {
this.listProjects = projects;
error => {
// error handling

In the network tab of the Chrome Developer Tools I see the request is made two times, once the initiator is zone.js, the other time it just says "Other". Can anyone explain this behaviour?


I think that is preflight request. These are made before the actual request. Your preflight response needs to acknowledge these headers in order for the actual request to work.Once you send this response to the preflight request, the browser will make the actual request.