Reputation: 94
createEmpModule.controller('createEmpCtrl', function ($scope, $http) {
$scope.listDatas = function () {
$http.post("/Common/Common/GetLanguages").then(function (result) {
$scope.list = result;
});
}
$scope.listDatas();
});
angular.min.js:9827 POST http: //localhost:xxxxx/Common/Common/GetLanguages 500 (Internal Server Error)
Angular Error Line:
xhr.send(post || null);
So, function back returns values,
Upvotes: 1
Views: 17814
Reputation: 94
I found a bug solution. It was not the object type from the control object. I created a new model and I solved.
Server Error in '/' Application.
? ? Type 'System.Collections.Generic.Dictionary`2[[System.SByte, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' is not supported for serialization/deserialization of a dictionary, keys must be strings or objects.
Upvotes: 1
Reputation: 1486
The first thing that jumps out at me is that you are making an $http.post()
without sending any data.
$scope.listDatas = function () {
$http.post("/Common/Common/GetLanguages", [dataObjectGoesHere]).then(function (result) {
$scope.list = result;
});
}
My guess is that you want .get() instead.
$scope.listDatas = function () {
$http.get("/Common/Common/GetLanguages").then(function (result) {
$scope.list = result;
});
}
The second thing I will say is check your server error logs! They will hold the key to what is causing your 500 error. I am willing to bet $1.00 that you are getting an error about trying to POST without data to a location expecting a GET request.
Upvotes: 1