I am pretty new to Angular 2.
I have 2 services, for this example lets say location and price. My first service calls for the users location and returns, the currency code and symbol, based on their IP address (not perfect but for this example it's fine) the following gets returned:-
{"code": "EUR","symbol": "€"}
When I attempt to inject a value from the into another service the service doesn't return any data
private Prices(){
console.log(this.allPrices);
return this.allPrices;
}
this.locationService.getLocation().subscribe(
location => {this.currency = location},
error => console.log("Error: ", error),
() => {
console.log(this.currency),
this.priceApi.find({where: {currency: this.currency.code}}).map(this.Prices)
}
)
Am I approaching this completely wrong?
Am help would be greatly appreciated, even if you point me in the correct direction so I am able to learn for myself.
If you require me to post any further code please let me know.
Thank you in advance!
@str thank you for your feedback
I have attempted what I have seen on Chaining Observables in RxJS But it just console.logs out:-
Observable {_isScalar: false, _subscribe: function}