Angular – two subscriptions in ngOnInit result in object ‘undefined’

If you want to return observables in a sequential manner, you shouldn’t nest your subscribe() methods. Instead, we should be using RxJS’s mergeMap to map over the observable values from the activatedRoute into an inner observable, which is assigned to the newsID property. Then, we call the getSectors() method from _newswireService, and the observables are … Read more

Adding a custom field to Magento’s subscription module

If you want to add some custom fields for Magento newsletter subscriber (for example subscriber_name), you should do the following: Add new column for newsletter_subscriber table Add text input to newsletter template Create observer for newsletter_subscriber_save_before event In the observer you can get your custom field’s value from request and assign it to subscriber’s object: … Read more

Angular/RxJS When should I unsubscribe from `Subscription`

TL;DR For this question there are two kinds of Observables – finite value and infinite value. http Observables produce finite (1) values and something like a DOM event listener Observable produces infinite values. If you manually call subscribe (not using async pipe), then unsubscribe from infinite Observables. Don’t worry about finite ones, RxJs will take … Read more