Md Hohn Md Hohn - 11 months ago 62
JSON Question

Why is angularJS not binding data?

Here I'm fetching maxim salary from Employee table.The JSON realize data properly but why angular not binding data

app.controller('AdminCntrl', function ($scope, AdminServices) {
$scope.BtnSubmit = function () {
var Bust = AdminServices.Getmax();

Bust.then(function (d) {
$scope.Emp =;



app.service('AdminServices', function ($http) {

this.Getmax = function () {
var ss = $http({
url: '/Department/Max',
method: 'Get',
content:{'content-type' : 'application/Json'}
return ss;


public JsonResult Max()
var xxx = db.Employees.OrderByDescending(ww => ww.Salary).First();
return new JsonResult { Data = xxx, JsonRequestBehavior = JsonRequestBehavior.AllowGet };


<div ng-controller="AdminCntrl">
<input type="button" class="btn btn-primary btn-sm" value="Min" ng-click="BtnSubmit()" />

<div ng-repeat="Accessor in Emp">
<span style="color:red">{{Accessor.Name}}</span>

Fiddler Catch Data


Answer Source

Is the value of $scope.Empequal to your Fiddler Data?

It appears you're not returning an array which is what ng-repeat is expecting. I'd bet if your Fiddler data was represented as an array:


you'd see it bind.

Alternatively, if you're really not expecting an array then if you replace

<div ng-repeat="Accessor in Emp">
     <span style="color:red">{{Accessor.Name}}</span>


       <span style="color:red">{{Emp.Name}}</span>

You'd have some success