in app.component.ts
ngAfterViewInit(){
this.weather.getPosition().then(resp=>{
this.weather.currentWeather(resp.coords.longitude,resp.coords.latitude)
.subscribe(
res =>{
console.log(res);
}
)
});
}
in Providers
import ‘rxjs/add/observable/forkJoin’;
import ‘rxjs/add/operator/map’;
import ‘rxjs/Rx’;
currentWeather(lon: number, lat: number): Observable<any> {
const currentInfo = this.http.get(http://api.openweathermap.org/data/2.5/weather?lat=${lat}&lon=${lon}&units=metric&APPID=${this.apiKey}
);
const forecastInfo = this.http.get(http://api.openweathermap.org/data/2.5/forecast/daily?lat=${lat}&lon=${lon}&units=metric&cnt=10&APPID=${this.apiKey}
);
return Observable.forkJoin([currentInfo, forecastInfo])
.map(responses => {
return .concat(…responses);
});
}
Attaching the image of the Error.
Please Help