title: AngularJS $http.get with ngRoute how to list details
body: <p>Maybe someone will help me. I write an app in angularjs, I have a file named list.html which retrieves a list of posts from jsonplaceholder and lists them, with a link to the details of the post. In $ routeParams, I pass the id of the selected one and pick it up. Unfortunately, I have no idea how to download the details of a post and display them in the details.html file. If I want to remove something for example, I write for example $ scope.deletePost as a function and give an id, but how to list details I have no idea.</p>
  
  <p>//routing.js</p>
  
  <pre><code>var myApp = angular.module('myApp', ["ngRoute"])
  myApp.config(['$routeProvider',
      function ($routeProvider) {
          $routeProvider
              .when('/test', {
                  templateUrl: '/event/example.html',
                  controller: 'exampleController'
              }, null)
              .when('/list', {
                  templateUrl: '/event/list.html',
                  controller: 'exampleController'
              }, null)
              .when('/test-list', {
                  templateUrl: '/test/list.html',
                  controller: 'testController'
              }, null)
              .when('/test/:id', {
                  templateUrl: '/test/details.html',
                  controller: 'testController'
              }, null)
      }
  ]);
  </code></pre>
  
  <p>//controller.js</p>
  
  <pre><code>angular.module('myApp').controller('testController', function ($scope, $http, $routeParams) {
      $http.get('https://jsonplaceholder.typicode.com/posts').then(function (response) {
          $scope.posts = response.data;
      });
  
      $scope.id = $routeParams.id;
  
  
  });
  </code></pre>
  
  <p>//details.html</p>
  
  <pre><code>&lt;div data-ng-controller="testController"&gt;
      {{data}}
  &lt;/div&gt;
  </code></pre>
  
  <p>//list.html</p>
  
  <pre><code>&lt;div data-ng-controller="testController"&gt;
      &lt;ul&gt;
          &lt;li ng-repeat="post in posts"&gt;
            Tytuł: {{post.title}} &lt;a href="#!test/{{post.id}}" &gt;Show&lt;/a&gt;
          &lt;/li&gt;
      &lt;/ul&gt;
  &lt;/div&gt;
  </code></pre>