AngularJS Example:
HTML
<link rel="stylesheet" href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css">
<body ng-app="myapp">
<section ng-controller="mycontroller">
<div class="y" ng-repeat="item in items">{{item.title}}<hr><hr>
</div>
</section>
</body>
JavaScript
//Non working scenario with "then"
/*
var app = angular.module("myapp", []);
app.controller("mycontroller", function($scope, $http, $timeout) {
var url = "http://jsonplaceholder.typicode.com/albums";
$http.get(url).then(
function(response) {
$scope.items = response;
});
});
*/
//working scneario with "success"
var app = angular.module("myapp", []);
app.controller("mycontroller", function($scope, $http, $timeout) {
var url = "http://jsonplaceholder.typicode.com/albums";
$http.get(url).success(
function(response) {
$scope.items = response;
});
});