I am trying to loop through an array of incoming data so that I can display the information on a map in leaflet!
here is my class:
export class OpenStreetMapComponent implements OnInit {
@Output() private add = new EventEmitter();
@Output() private edit = new EventEmitter<number>();
artworkList: Artwork[];
the data as it comes in is stored in the artworkList array
constructor(private artworkService: ArtworkService) { }
ngOnInit() {
this.refresh();
}
refresh() {
this.artworkService.retrieveAll().then(
artworkList => this.artworkList = artworkList
);
for (let artwork of this.artworkList) {
console.log(artwork.name);
}
for some reason i keep getting this error is my console:
ERROR TypeError: "_a is undefined"
thencall.