'TypeError: Cannot read property 'headers' of null! MEAN stack
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:
The error in the console:
CORS is allowed on the backend side and I don't know what else to try.
Any suggestions?
Solution 1:[1]
Maybe because http.post returns a promise, not an array as you assume by calling .map on the result.
See https://docs.angularjs.org/api/ng/service/$http#post.
A valid example would be:
$http
.post('/someUrl', data, config)
.then(successCallback, errorCallback);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Ioan |


