Read specific columns from JSON with AngularJS

Apr 24 2018 4:00 AM
Hello guys..
 
What is the problem?
 
Html:
  1. <!DOCTYPE html>  
  2. <html ng-app="App">  
  3. <head>  
  4. <title>Angular</title>  
  5. <meta charset="UTF-8">  
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">  
  7. <meta http-equiv="X-UA-Compatible" content="ie=edge">  
  8. <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>  
  9. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">  
  10. <script src="App.js"></script>  
  11. </head>  
  12. <body ng-controller="Controller">  
  13. <div class="container">  
  14. <table class="table">  
  15. <tr>  
  16. <th>ID</th>  
  17. <th>Name</th>  
  18. <th>EMail</th>  
  19. </tr>  
  20. <tr ng-repeat="user in users">  
  21. <td>{{user.id}}</td>  
  22. <td>{{user.name}}</td>  
  23. <td>{{user.email}}</td>  
  24. </tr>  
  25. </table>  
  26. </div>  
  27. </body>  
  28. </html>  
Js:
  1. var app = angular.module("App", []);  
  2. app.controller("Controller"function ($scope, $http) {  
  3. var url = "https://jsonplaceholder.typicode.com/users";  
  4. $http.get(url).then(function (response) {  
  5. $scope.users = response;  
  6. });  
  7. });

Answers (1)