I am trying to populate items from the returned async call.
this._service.getAll()
.subscribe(
data => {
this.items = data.map(function (item) {
return { a: item.a, b: item.b };
}, error => console.error('error: ', error))
});
console.log(items);
Being async call, the assignation is not happening immediately and therefore I am not getting the values in items in the next line of code, as such console.log(items) prints null.
How do I make sure that items is not null.