title: How to pass parameter in DELETE request in Angular2
body: <p>I am trying to create a <code>Delete</code> request in <strong><a href="http://www.angular2.com/" rel="nofollow noreferrer">Angular 2</a></strong>.</p>
  
  <p>What I have done is something like this-</p>
  
  <pre><code>import { Component } from '@angular/core';
  import { Http, RequestOptions, URLSearchParams } from '@angular/http';
  //import { Http, Response, Headers, RequestOptions, URLSearchParams } from '@angular/http';
  import { Profile } from '../../dataModel/Profile.ts';   //Data Model
  
  @Component({
      selector: 'profile-list',
      template: require('./profileList.component.html'),
      styles: [require('./profileList.component.css')]
  })
  
  export class ProfileListComponent
  {
      private _deleteProfileUrl: string = "/api/Profile/Delete";
  
      constructor(private http: Http)
      {
      }
  
      public deleteProfile(profileId)
      {
          this.http.delete(this._deleteProfileUrl, new RequestOptions({
              // Have to make a URLSearchParams with a query string
              search: new URLSearchParams('profileId=' + profileId) // &lt;-----
          }));
  
          alert("Deleted - " + profileId);
      }
  }
  </code></pre>
  
  <p>So, I am creating a Delete request like this-</p>
  
  <pre><code>this.http.delete(this._deleteProfileUrl, new RequestOptions({
          // Have to make a URLSearchParams with a query string
          search: new URLSearchParams('profileId=' + profileId) // &lt;-----
      }));
  </code></pre>
  
  <p>but it is not working and not giving any error.</p>
  
  <p>Because if the <strong><code>deleteProfile</code></strong> function is called, only <code>alert</code> is coming, but no AJAX request is done.</p>
  
  <p>Because I am having something like this after the function is called-</p>
  
  <p><a href="https://i.stack.imgur.com/Oardk.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Oardk.jpg" alt="enter image description here"></a></p>
  
  <p>I am assuring that API is working perfectly.</p>
  
  <p>So, can anyone please help me what I am doing wrong?</p>
  
  <h2>Moreover-</h2>
  
  <p>My complete code can be found <a href="https://github.com/abrarjahin/Dot.NetCore_Angular2_App" rel="nofollow noreferrer">here (if needed)</a>.</p>
  
  <p>Thanks in advance for helping.</p>