3 ms·
you can refactor those nested observables using mergeMap: this._settingsService.settings$.mergeMap(settings => { this.settings = settings;
by lloyd-christmas 10y ago
you can refactor those nested observables using mergeMap:
this._settingsService.settings$.mergeMap(settings => {
this.settings = settings;
return this._weatherService.getLatestWeather(this._location, settings);
})
.subscribe(
weather => this.weather = weather,
error => this.errorMessage = <any>error
);
- quaffapint 10y agoThanks. Learning observables was definitely a little challenging, so I appreciate the insight.
- namelezz 10y agoThanks you for sharing such a beautiful weather app.