Add an HTTP response to a panel

0

My question is the following, I generate 6 paneis determined in the file script.js that has names defined as Paineis1, Paineis2 ... what would you like, do a get in a url, and for every url that i call it add the answer inside the panel

I have the following index.html:

<!DOCTYPE html>
<html lang="en">
<head>
    <link rel="stylesheet" href="style.css" />
    <script src="//code.angularjs.org/snapshot/angular.min.js"></script>
    <script src="script.js"></script>

    <meta charset="UTF-8">
    <title>Title</title>

</head>
<body>

<div ng-app="myApp">
  <div ng-controller='myController'>
    <div class='painel' ng-repeat='i in paineis'>{{i}}</div>
  </div>
</div>

</body>
</html>

scripts.js:

angular.module('myApp', [])
.controller('myController', function($scope){
  $scope.paineis = ['Painel1','Painel2','Painel3','Painel4','Painel5','Painel6'];
});

response.js:

angular.module('myApp', [])
.controller('myCtrl', function($scope, $http) {
  $http.get("http://jsonplaceholder.typicode.com/posts/1/commentsssss")
  .then(function(response) {
      $scope.content = response.status;
  }, function(response) {
      $scope.content = response.status;
  });
});
    
asked by anonymous 02.02.2017 / 22:38

0 answers