This is the problem: I have a service that makes an HTTP request in the constructor:
constructor(public http: Http, public geolocation: Geolocation) { this.http = http; this.geolocation = geolocation;
then I embed this service in a component like this:
constructor(public connector: ApiConnector) { this.forecast = connector.forecast; }
If I try to use the component class prediction element on the component decorator, as I here:
@Component({ selector: 'app', directives: [MainForecast, DailyForecast], template: ` <main-forecast [main-weather]="forecast"></main-forecast> <daily-forecast [weather-list]="forecast.list"></daily-forecast> `, })
I get the error "I can not read the list of undefined properties in ..."
Is it possible to work with promises in the component constructor?
source share