title: Angular pass a parameter from service to mvc controller
body: <p>I am very new to Angular and MVC.I am trying to pass a parameter from my view to the mvc controller. After I delete the record do I need to refresh the view to see the changes.
  Thank you in advance for your help. </p>
  
  <pre><code>myApp.service("deleteService", function ($rootScope, $http)
  {
      this.removeRow = function (recId) {
  
          $http.delete("CurrentSettingsController.cs/DeleteRecord", { params: { recordId: recId } })
          .success(function (data, status, headers, config) {
              window.location.reload();
          })
          .error(function (data, status, header, config) {
          });
      }
  });
  
  myApp.controller('myController', ['$scope', 'companiesService', 'allCurrentSettingsService','deleteService',
    function ($scope, companiesService, allCurrentSettingsService, deleteService) {
        $scope.currentSettings = '';
        companiesService.getList().then(function (value) {
            $scope.currentSettings = value;
  
        }),
        $scope.allSettings = '';
        allCurrentSettingsService.getList().then(function (value) {
            $scope.allSettings = value;
  
        }),
         $scope.deleteRecordFromDB = function (recId) {
             deleteService.removeRow(recId);
         };
    }
  ]);
  
  [HttpPost]
  public static void DeleteRecord(int settingID)
  {
      try
      {
          using (SqlConnection conn = new SqlConnection(connString))
          {
              conn.Open();
              using (SqlCommand command = new SqlCommand("DeleteCurrentRecord", conn))
              {
                  command.CommandType = System.Data.CommandType.StoredProcedure;
                  command.Parameters.Add("@SettingId", SqlDbType.VarChar).Value = settingID;
                  command.ExecuteNonQuery();
                  command.Parameters.Clear();
              }
              conn.Close();
          }
      }
      catch (Exception ex)
      {
          Console.Write(ex.ToString());
      }
  }
  </code></pre>