I'm aware this question has been asked before, I've looked at other answers but I cant seem to fix the problem. I keep receiving a null object server side when using $http.Get with angular js. Can anyone find what im missing or what i've done wrong?
My angular:
module.controller("albumReviewController", function ($http, $scope) {
var albumID = $(".ui-albumID").find("input").val();
$http(
{
method: 'Get',
url: 'api/AlbumAPI/GetTotalAlbumRatings',
data: { albumid: albumID }
}).then(function successCallback(response) {
$scope.totalRating = response.data;
}), function errorCallback(response) {
window.console.log(response);
};
};
});
and my api controller:
[HttpGet("GetTotalAlbumRatings")]
[Route("api/AlbumAPI/GetTotalAlbumRatings/{model}")]
public JsonResult GetTotalAlbumRatings([FromBody]RatingAngularViewModel model)
{
// do stuff
}
and the model:
public class RatingAngularViewModel
{
public string AlbumID { get; set; }
public RatingAngularViewModel()
{
}
}
I'm trying to send a get request to retrieve some values from the server but my model is always null.