Velvet Star Monitor

Standout celebrity highlights with iconic style.

updates

TypeError: Cannot read property 'headers' of null! MEAN stack

Writer Sophia Terry

I am making a simple ToDoApp with MEAN (Angular 2) stack but I have a problem with the http.post request. Always when I am running the post method, the current JSON object gets inserted into the database. But right after I get an error message and also my current server connection breaks down.

Insert method:

post method

The error in the console:

Console error

CORS is allowed on the backend side and I don't know what else to try.

Any suggestions?

2

1 Answer

Maybe because http.post returns a promise, not an array as you assume by calling .map on the result.

See $http#post.

A valid example would be:

$http
.post('/someUrl', data, config)
.then(successCallback, errorCallback);
1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy