mardi 8 novembre 2016

Data not showing ng-repeat

My Html code is here

<div ng-controller="ServiceAreaController">
    <table class="table">
        <thead>
            <tr>
                <th>ID</th>
            </tr>
        </thead>
        <tbody>
            <tr ng-repeat="ServiceArea in ServiceAreas">
                <td></td>
            </tr>
        </tbody>
    </table>
</div>

API request

app.controller('ServiceAreaController', function($scope, $http, API_URL) {
    var ServiceAreaUrl = API_URL + "apiServiceAreas";
    $http({
        method:         'POST',
        url:            ServiceAreaUrl,
        async:          true,
        contentType:    "application/json; charset=utf-8"
    }).success(function(response) {
        if(response["Status"]) {
            $scope.ServiceAreas = response["Data"];
        }
    }).error(function(response) {
        console.log(response);
    });
});

response["Data"] is like below

"Data": [
    {
      "ServiceAreaID": 67,
      "ServiceArea": "116123"
    },
    {
      "ServiceAreaID": 68,
      "ServiceArea": "101708"
    },
    {
      "ServiceAreaID": 69,
      "ServiceArea": "101708"
    }
]

It generates total three tr but td is not showing any data. Am I missing anything?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire