I have this class:
export class Example {
  id: number;
  name: string;
  map: Map<string,boolean>;
  constructor(id: number, name: string, map: Map<string,boolean>) {
    this.id = id;
    this.name = name;
    this.map = map;
  }
}
And when I try to call the get() on the map attribute of an instance like this:
let temp = example.map.get("key");
I get this error:
ERROR TypeError: example.map.get is not a function
Also I'm using Spring boot so how can I make sure I'm sending and receiving the map attribute without messing it up?
What am I doing wrong? Why isn't it recognized as a Map?
And this returns false:
map instanceof Map
And the empty attribute looks like this when I show it on the website:
\[object Object\]
Edit: I create instances in 2 ways:
- When the data arrives from the backend:
in the service.ts file:
getExamples(): Observable<Example[]>{
   return this.http.get<Example[]>(this.baseUrl);
}
in the component.ts file:
this.exampleService.getExamples().subscribe((data: Example[]) => {
   console.log('Received examples: ',data);
   this.examples = data;
});
I logged it and the Map attribute looks like this in the data:
Object { "text": true }
- When the user creates a new instance with a Form:
    const example= this.exampleForm.value as Example;
