title: Parse JSON with angularJS
body: <p>Here is my JSON which provides from an API. JSON is correctly generated (with a cat variable attribute url)</p>
  
  <pre><code>{
  "api":
    {"version":"1.0",
     "url":"http:\/\/www.example.com",
     "encoding":"UTF-8",
     "generated":"2016-11-28T15:12:18+01:00",
     "contents":"categories_hierarchical"},
  "0":{"id":"46",
       "name":"Music",
       "parent_id":"56",
       "event_count":"411",
       "rank":1}
  }
  </code></pre>
  
  <p>First element (<code>api</code>) doesn't need to be displayed. I just want the second (<code>key: 0</code>)</p>
  
  <p>My factory :</p>
  
  <pre><code>.factory('selectedCategoriesService', function($http, $stateParams) {
          var selectedCategories = [];
  
          return {
          getselectedCategories: function(){
              return $http.get('http://www.myapi.com&amp;data=categorie', { params: { cat: $stateParams.id } }).then(function(response){
                  selectedCategories = response.data;
                  return response.data;
              });
          },
      getselectedCategorie: function(selectedCategorieId){
          for(i=0;i&lt;selectedCategories.length;i++){
              if(selectedCategories[i].id == selectedCategorieId){
                  return selectedCategories[i];
              }
          }
      }
  }
  })
  </code></pre>
  
  <p>My controller : </p>
  
  <pre><code>.controller('CategoriesListDetailCtrl',function($scope, $stateParams, selectedCategoriesService){
  
      var selectedCategorieId = $stateParams.id;
      $scope.selectedCategorie = selectedCategoriesService.getselectedCategorie(selectedCategorieId);
  
    selectedCategoriesService.getselectedCategories().then(function(selectedCategories){
    $scope.selectedCategories = selectedCategories;
    console.log($scope.selectedCategories);
      })
  })
  </code></pre>
  
  <p>The simple template :</p>
  
  <pre><code>&lt;ion-pane&gt;
  
    &lt;ion-view view-title="{{selectedCategorie.name}}"&gt;
  
      &lt;ion-content class="has-header"&gt;
  
          &lt;ion-item class="item-thumbnail-left"&gt;
  
             &lt;h2&gt;{{selectedCategories.id}}&lt;/h2&gt;
  
          &lt;/ion-item&gt;
  
      &lt;/ion-content&gt;
  
    &lt;/ion-view&gt;
  
  &lt;/ion-pane&gt;
  </code></pre>