title: AngularJS: How to fetch data of specific id from JSON file
body: <p>In my controller class I fetch the id of specific user from URL and then send it to service <code>OrderService</code> Now in the service I want to retrieve the data of this id from JSON file , How can I achieve this ?</p>
  
  <p><strong>OrderCtrl</strong></p>
  
  <pre><code>'use strict';
  angular.module('Orders').controller('OrderCtrl', ['$scope', '$state', "SettingService", "OrderService","$stateParams", function($scope, $state, SettingService, OrderService,$stateParams) {
  
  
   var OrderId = $stateParams.orderId;
  
   $scope.orders = [];
  
    OrderService.getOrderDetails(OrderId).then(function(response){
      $scope.orders = response.data.data;
    }, function(error){
  
    })
  
  }]);
  </code></pre>
  
  <p><strong>OrderService.js</strong></p>
  
  <pre><code>angular.module('Orders')
      .service('OrderService', ['$http', '$state', '$resource', '$q', 'SettingService', '$localStorage', "MessageService",
       function($http, $state, $resource, $q, SettingService, $localStorage, MessageService) {
          var service = {
              getOrderDetails : function(OrderId){
              Here I want to retrieve data from JSON file
  
      });
              }
  
          }
  
          return service;
      }]);
  </code></pre>