2016-08-04 4 views
0

크리켓 경기 정보와 관련된 애플리케이션을 생성 중입니다. API 응답을 가져 오는 중 문제가 발생했습니다. 당신은 API 응답 here를 확인할 수 있습니다. 콘솔 오류를 보여주고, 확인하시기 바랍니다 여기에각도로 API 데이터 가져 오기

here 내 코드입니다 : 실제 데이터이기 때문에

<!doctype html> 
<html> 
<head> 
<meta charset="utf-8"> 
<title>Untitled Document</title> 
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> 
</head> 

<body> 
<div class="container" ng-app="cricApp" ng-controller="cricCtrl"> 
<div class="form-group"> 
<h2>Your result</h2> 
<table class="table table-striped"> 
    <thead> 
     <tr><th colspan="4"><h4>Cricket Match Info</h4></th></tr> 
     <tr> 
     <th>Sno</th> 
     <th>unique_id</th> 
     <th>description</th> 
     <th>title</th> 
     </tr> 
    </thead> 
    <tbody> 
     <tr ng-repeat="match in matchList | filter: nameFilter"> 
     <td>{{$index + 1}}</td> 
     <td> 
      {{match.unique_id}} 
     </td> 
     <td>{{match.description}}</td> 
     <td>{{match.title}}</td> 
     </tr> 
    </tbody> 
    </table> 
</div> 
</div> 
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.0/angular.min.js"></script> 
<script> 
angular.module('cricApp', []). 
controller('cricCtrl', function($scope, $http) { 
$scope.matchList = []; 
    $http.get("http://cricapi.com/api/cricket").then(function (response) { 
     console.log(response); 
     $scope.matchList = response.data; 
    }); 
} 
); 
</script> 
</body> 
</html> 
+0

'console.log (응답); 응답을 게시 할 수 있습니까? –

+0

도착하는 오류 메시지의 첫 번째 줄에 URL ('http : //errors.angularjs ....')이 표시됩니다. 해당 URL을 클릭하면 오류에 대한 정보가 표시되지 않습니다. –

+0

에서 필터를 제거하고 시도하십시오 –

답변

3

코드가 잘 단지

$scope.matchList = response.data; 

$scope.matchList = response.data.data; 

교체 response.data 내부에 데이터가 들어옵니다.

+0

좋은 spotting !! –

+0

정말 고마워요 !! 지난 이틀 동안 이것에 집착하고있어 .. –

+0

. 천만에. 나는 그것을 행복하게했다. – localhost

관련 문제