I'm trying to make an api call and assign the result using async code. here is what i have.
public async getInfoFeed(): Promise<Feed> {
let returnVal: Feed;
await this.http.get(url)
.map(res => res.json())
.subscribe(
data => returnVal = data,
err => console.log(err)
)
return returnVal;
}
var info = await this.getInfoFeed();
console.log(info);
by the time the code completes, info is 'undefined'. How can i make this method asynchronous?