i'm trying to get Book data from Mysql with springBoot (BackEnd) and Angular(FrontEnd) but evrey time i get this error ERROR TypeError: this.booksRecieved is not iterable, can any one plaise help me.
This is the function where i get the error.
books: Array<Book>;
booksRecieved: Array<Book>;
refreshData(){
this.books=new Array<Book>();
this.httpClientService.getBooks().subscribe(
(response) =>
//get books returned by the api call
this.booksRecieved = response,
);
for (const book of this.booksRecieved) {
const bookwithRetrievedImageField = new Book();
bookwithRetrievedImageField.id = book.id;
bookwithRetrievedImageField.name = book.name;
//populate retrieved image field so that book image can be displayed
bookwithRetrievedImageField.retrievedImage = 'data:image/jpeg;base64,' + book.picByte;
bookwithRetrievedImageField.author = book.author;
bookwithRetrievedImageField.price = book.price;
bookwithRetrievedImageField.picByte=book.picByte;
this.books.push(bookwithRetrievedImageField);
}