I am fetching data in MVC and returning as Json. Although i am receving it in Angular controller but still getting Json in raw format.
Here is my MVC code...
public JsonResult Menu() {
var result = db.Departments.Include(y => y.Employee).ToList();
return Json(result, JsonRequestBehavior.AllowGet);
}
and here is my Angular Controller.
angular.module('ContactController', []).controller("ContactController", ['$scope', '$http', function ($scope, $http) {
$scope.model = {};
$http.get('/Contact/Menu').then(function(response) {
$scope.model = response.data;
})
}])
Here is View..
{{x.Name}}
and output in view is like this:
[{"Id":1,"Name":"Accounts","Employee":[]},{"Id":2,"Name":"Sales","Employee":[]}]
any idea what m i missing???
2 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Iram KhanPosted Feb 2, 2018, 1:01 PM
Mehul PrajapatiPosted Feb 2, 2018, 12:35 PM