asynchronous http request 2
by neptune001
HTML
<div ng-app="ConfigInfo" ng-controller="ConfigController">
{{estimatedTime}}
<hr/>
{{configInfo()}}
</div>
JavaScript
var app = angular.module('ConfigInfo', []);
app.run(function($rootScope, $http) {
$rootScope.configInfo = 'no config';
$http.get('https://s3.amazonaws.com/codecademy-content/courses/ltp4/shows-api/shows.json').success(function(data) {
$rootScope.configInfo = data;
});
});
app.controller('ConfigController', function ($scope, $rootScope, $http) {
$scope.configInfo = function() { return $rootScope.configInfo; }
$scope.estimatedTime = $scope.configInfo();
});