<table>
   <tr ng-repeat="objective in objectives">
       <td>
          <p> {{objective.name}} </p>
          <table>
            <tr ng-repeat="data in getData(objective.id)">
              <td> {{data.value}} </td>
            </tr>
          </table>
       </td>
    </tr>
</table>
my controller code is ---
objectiveService.getObjective().success(function (data) {
    $scope.objectives = data;
    $scope.loading = false;
})
.error(function (data) {
    $scope.error = "An Error has occured while loading posts! " + data.ExceptionMessage;
    $scope.loading = false;
});
$scope.getData = function (id) {
    $scope.loading = true;
    var currentObjective = id;
    objectiveService.getObjectiveById(currentObjective).success(function (data) {
       $scope.loading = false;
       return data;
    }).error(function (data) {
        $scope.error = "An Error has occured while Saving Objective! " + data.ExceptionMessage;
        $scope.loading = false;
    });
};
i am working on AngularJS, above is my code which i am using, but this loop is going to infinite time and i don't understand where i did wrong, can anyone please help me
 
     
    