Twitch API with AngularJS

I’m trying to pull the list of current streams from the API and iterate that information with AngularJS. When I put in the JSON data directly in the js file, Angular works fine. However, when using an http request as shown below, I get a blank page. Any help is appreciated. Thanks!

Http file:

<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
</head>
<body>
   <div ng-app="myApp" ng-controller="namesCtrl">
      <ul>
         <li ng-repeat="x in names">
            {{ x.game }}
         </li>
      </ul>
   </div>
<script src="repeat.js"></script>
</body>
</html>

JS page:

var app = angular.module('myApp', []);
app.controller('namesCtrl', function($scope, $http) {
    $http.get("https://api.twitch.tv/kraken/streams")
    .success(function(response) {$scope.names = response.streams;});
});

It seems to work fine for me: https://jsfiddle.net/30tk4sL0/

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.