I am currently using the following versions: Angular CLI: 10.0.1
Node: 12.18.2
OS: win32 x64
Angular: 10.0.2
In my setup, I have a Java Spring Boot service that is functioning correctly and returns data as a HashMap.
Map<String, List<String>>
This is the response of the service call:
// 20200728103825
// http://localhost:1234/config-data
{
"books": [
"ABC",
"PQR",
"XYZ",
"QWT",
"LMN",
],
"categories": [
"FICTION",
"DRAMA"
]
}
I also have a simple endpoint that returns a list of books as strings. For example:
// 20200728112259
// http://localhost:1234/book-data
[
"ABC",
"PQR",
"XYZ",
"QWT",
"LMN",
]
Now, I need to incorporate this data into my Angular code.
The service I have defined looks like this:
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
@Injectable({
providedIn: 'root'
})
export class DataService {
constructor(
private http: HttpClient
) { }
loadBookData(){
console.log("loadBookData Service");
return this.http.get<string[]>('http://localhost:1234/book-data');
}
loadConfigData() {
console.log("loadConfigData Service");
// Need assistance here
}
}
Currently, I am able to retrieve the book data (string[]).
However, I am unsure how to handle and parse complex data stored as a HashMap from the service.