title: calling Wcf rest Service in Angular JS with in the function is not working with $http
body: <p>Hi iam trying to call the Wcf rest service when change the list item in angular JS</p>
  
  <p>here is my sample code </p>
  
  <pre><code> function sample($scope, $http) {
  
  $http({
      url:     'http://localhost/DataFlow.InternalServices/Service.svc/rest/GetClientValues',
     headers: { 'MyCustomHttpHeader': xmlInput }
  }).
      success(function (data) {
          var ClientsData = angular.fromJson(eval("(" + data.GetClientValuesResult + ")"))
          $scope.availableClients = ClientsData.ListData;
      });
  
  $scope.selectedClients = [];
  
  $scope.loadEntities = function (selectedItem) {
      sToken = GenerateToken();
      var selClients = "";
      for (var i = 0; i &lt; selectedItem.length; i++) {
          selClients = selClients + "," + selectedItem[i].ClientID;
      }
      var selectedClients = selectedItem[0].ClientID;
      xmlInput = "&lt;security_token&gt;&lt;token&gt;" + sToken + "&lt;/token&gt;&lt;drawer_id&gt;0000000000&lt;/drawer_id&gt;&lt;clients&gt;" + selClients + "&lt;/clients&gt;&lt;/security_token&gt;"
      $http({
          url: 'http://localhost/DataFlow.InternalServices/Service.svc/rest/GetEntityByClient',
          headers: { 'MyCustomHttpHeader': xmlInput }
      }).
      success(function (data) {
          $scope.availableEntities = [];
          var EntityData = angular.fromJson(eval("(" + data.GetEntityListValuesByClientResult + ")"))
          $scope.availableEntities = EntityData.ListData;
      });
      $scope.selectedEntities = [];
  
  };
  </code></pre>
  
  <p>on calling of loadEntites i need to call service again and refresh the items but with the above techinique its always loading previous list only.</p>
  
  <p>how do i reload the latest data.</p>