[AngularJS] Re: Data not refreshed after Deleting from List

2018-09-25 Thread Partha Majumdar
You are right Mr. Sander.

The service is returning empty response.

I am reading to rectify that.

Thanks for your kind support.

Regards,
Partha

On Tuesday, 25 September 2018 09:51:24 UTC+5:30, Sander Elias wrote:
>
> Hi Partha,
>
> > The alerts I have placed are never fired.
>
> You mean the alerts in your first msg? If those are not fired, the 
> response from your node server is not reaching back your app. I just 
> noticed you are returning a 201. This might be the problem. Can you try 
> with a code 200?
> (BTW 201 means a successful creation, that's a strange response on a 
> delete...)
> Also, you should add an error-handling part in your service. checkout how 
> to handle errors in observables. hint the CatchError operator is your 
> friend.
>
> Regards
> Sander
>
>
>

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


[AngularJS] Re: Data not refreshed after Deleting from List

2018-09-24 Thread Sander Elias
Hi Partha,

> The alerts I have placed are never fired.

You mean the alerts in your first msg? If those are not fired, the response 
from your node server is not reaching back your app. I just noticed you are 
returning a 201. This might be the problem. Can you try with a code 200?
(BTW 201 means a successful creation, that's a strange response on a 
delete...)
Also, you should add an error-handling part in your service. checkout how 
to handle errors in observables. hint the CatchError operator is your 
friend.

Regards
Sander


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


[AngularJS] Re: Data not refreshed after Deleting from List

2018-09-24 Thread Partha Majumdar
The alerts I have placed are never fired.

On Tuesday, 25 September 2018 08:29:33 UTC+5:30, Partha Majumdar wrote:
>
> Dear Mr. Sander,
>
> I have subscribed to the listener in ngOnInit().
> The code is given below. I have doubt whether this is okay.
>
> This code I had written in ngOnInit(). Later I moved it to a function so 
> that I could call it from ngOnChange() as well. However, I am certain this 
> approach is not correct.
>
> Please advice.
>
> Regards,
> Partha
>
>
> ngOnInit() {
> this.refresh();
> }
>
> refresh() {
> this.isLoading = true;
> this.currencyService.getCurrencies();
> this.currencySubscription = this.currencyService.
> getCurrencyUpdatedListener()
> .subscribe( (currencies: Currency[]) => {
> this.currencyList = currencies;
> this.currencyData.data = this.currencyList;
> });
> this.currencyData.paginator = this.paginator;
> this.currencyData.sort = this.sort;
> this.isLoading = false;
> }
>
>
>
>
>
> On Tuesday, 25 September 2018 08:15:41 UTC+5:30, Sander Elias wrote:
>>
>> Hi Partha,
>>
>> Your code is ok. If the currency is not disappearing from the view, the 
>> mistake is not in this part. Are you sure you subscribed to the 
>> currencyListUpdated observable?
>>
>> Regards
>> Sander
>> ​
>>
>

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


[AngularJS] Re: Data not refreshed after Deleting from List

2018-09-24 Thread Partha Majumdar
Dear Mr. Sander,

I have subscribed to the listener in ngOnInit().
The code is given below. I have doubt whether this is okay.

This code I had written in ngOnInit(). Later I moved it to a function so 
that I could call it from ngOnChange() as well. However, I am certain this 
approach is not correct.

Please advice.

Regards,
Partha


ngOnInit() {
this.refresh();
}

refresh() {
this.isLoading = true;
this.currencyService.getCurrencies();
this.currencySubscription = this.currencyService.getCurrencyUpdatedListener
()
.subscribe( (currencies: Currency[]) => {
this.currencyList = currencies;
this.currencyData.data = this.currencyList;
});
this.currencyData.paginator = this.paginator;
this.currencyData.sort = this.sort;
this.isLoading = false;
}





On Tuesday, 25 September 2018 08:15:41 UTC+5:30, Sander Elias wrote:
>
> Hi Partha,
>
> Your code is ok. If the currency is not disappearing from the view, the 
> mistake is not in this part. Are you sure you subscribed to the 
> currencyListUpdated observable?
>
> Regards
> Sander
> ​
>

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


[AngularJS] Re: Data not refreshed after Deleting from List

2018-09-24 Thread Sander Elias


Hi Partha,

Your code is ok. If the currency is not disappearing from the view, the 
mistake is not in this part. Are you sure you subscribed to the 
currencyListUpdated observable?

Regards
Sander
​

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