Hi KJ,

If you want to use promises chaining then you have to return appropriate 
value from the service .then callback.
Take a look https://docs.angularjs.org/api/ng/service/$q (section - 
Chaining promises)

Best regards, Pavel

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:
>
> setProfileStatus: (status: boolean) => {
>  angularService.setProfileStatus(status).then(
> response => {
>      //my response is always undefined.
>      console.log(response.data);         
>   }).catch(err => {
>        //show error}); }
>
> In my above controller when I call my service my response is always 
> undefined. Here is my service:
>
> public setProfileStatus(status: boolean): ng.IPromise<any> {
>  var url = this._endpoints.myEndpoint + '?status=' + status;
>  return this._http.put<string>(url, '').then(response => {//response here is 
> fine, I can get data also and any error but I want to pass this to my 
> controller
>  });}
>
> 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.
>
> Thanks
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to