Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi
I'm trying to get a $http.post call going from angular but is getting an 404.
If I convert it to a Get it works fine. What am I doing wrong?
Here is my js
angular.module('umbraco.resources').factory('migrationResource', function ($q, $http) { return { migrateFiles: function (subnetId) { return $http({ method: 'POST', url: 'DBU/DBUApi/MigrateFiles', data: "SubnetId=" + subnetId }); //I've also tried this //return $http.post("DBU/DBUApi/MigrateFiles", { params: { SubnetId: subnetId } }); } }; } );
And here is my webapi function
[System.Web.Http.HttpPost] public int MigrateFiles(int SubnetId) { //bla bla.... return 1; }
change to this [FromBody]int SubnetId
/Paul S
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Doing $http.post from angular to web api
Hi
I'm trying to get a $http.post call going from angular but is getting an 404.
If I convert it to a Get it works fine. What am I doing wrong?
Here is my js
And here is my webapi function
Hi
change to this [FromBody]int SubnetId
/Paul S
is working on a reply...