[Answer]-Angular js unable to post data using $http.post

1👍

Iam not sure if it’s somewhere in your example or just something you do wrong elsewhere.
Down below is a working example of a POST in angular.

var config = {
    method: 'POST',
    url: '/api/studentplannedcredit/',
    data: variablesToSend 
};


$http(config)
.success(function(data, status, headers, config) {
    console.log(data);
})
.error(function(data, status, headers, config) {
    console.log(data);
});

PS: Dont POST for each loop.. that will hammer the API badly.. collect the data first and then send 1 POST only.

0👍

I am assuming, $modalInstance is the issue here.

Try to run without

$modalInstance.close();
👤premsh

Leave a comment