index.html
<!DOCTYPE html>
<html lang="pt-br" ng-app="alurapic">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<title>Alurapic</title>
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/bootstrap-theme.min.css">
<script src="js/lib/angular.min.js"></script>
<script src="js/main.js"></script>
<script src="js/controllers/fotos-controller.js"></script>
</head>
<body ng-controller="FotosController">
<div class="container">
<div class="jumbotron">
<h1 class="text-center">Alurapic</h1>
</div>
<div ng-repeat="foto in fotos" class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">{{foto.titulo}}</h3>
</div>
<div class="panel-body">
<img class="img-responsive center-block" src="{{foto.url}}" alt="{{foto.titulo}}">
</div>
</div> <!-- fim panel -->
</div> <!-- fim container -->
</body>
</html>
fotos-controller.js
angular.module('alurapic').controller('FotosController', function($scope, $http) {
$scope.fotos = [];
$http.get('v1/fotos')
.success(function(fotos) {
$scope.fotos = fotos;
})
.error(function(erro) {
console.log(erro);
});
});
Erros na console
GET file:///C:/Users/Antonio%20Rogerio/Downloads/ALURA/102%20Angular%201%3B%20crie%20webapps%20poderosas/ferramentas/alurapic/public/%7B%7Bfoto.url%7D%7D net::ERR_FILE_NOT_FOUND
angular.js:9866 XMLHttpRequest cannot load file:///C:/Users/Antonio%20Rogerio/Downloads/ALURA/102%20Angular%201%3B%20crie%20webapps%20poderosas/ferramentas/alurapic/public/v1/fotos. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.