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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.