title: How to handle response & error in Angular JS service with typescript
body: <p>I am using angular js to call my wcf service that returns some data. Now if my wcf service throws exception I want to handle that accordingly. 
  My flow of call in angular is like this:
  My page controller calls the angular service which calls my wcf service using $http.
  My Controller:</p>
  
  <pre><code>setProfileStatus: (status: boolean) =&gt; 
  {
   angularService.setProfileStatus(status).then(
  response =&gt; {
       //my response is always undefined.
       console.log(response.data);         
    })
  .catch(err =&gt; {
         //show error
  }); 
  }
  </code></pre>
  
  <p>In my above controller when I call my service my response is always undefined.
  Here is my service:</p>
  
  <pre><code>public setProfileStatus(status: boolean): ng.IPromise&lt;any&gt; {
   var url = this._endpoints.myEndpoint + '?status=' + status;
   return this._http.put&lt;string&gt;(url, '').then(response =&gt; {
  //response here is fine, I can get data also and any error but I want to pass this to my controller
   });
  }
  </code></pre>
  
  <p>In my above service call I can get the response fine, with any data that was returned from my wcf service.
  So how to pass this to my controller so that same response I can see in my controller.</p>
  
  <p>Thanks</p>