I have a simple model declared in angular as an interface.
I am trying to get some data by calling the Get method of the HttpClient as this:
where the field this.plugs
is an array of Plug
elements.
This data I am trying to display in a table in my page as this:
The data is not displayied. After I did some investigation in my code it seems that if I log the whole data that is returned from the HTTP call it is shown as it is supposed to be (a list of objects of type Plug
) but if I try to console.log one field of a object from the array it shows up as undefined and I can't figure out why.
I believe that this is the problem in my code and that's why the data is not displayied in the table.
Here is the results for console.log
of the object that is returned from HTTP get call and also result for console.log after casting the result to a local variable.
My question is why does it behave this way and what can I do to fix this?
What I tried is I have looped through the data that is returned from the HTTP GET call and foreach of them create a new objecte of type Plug
and assign its ,members in order. But if I do that all the members shown up as undefined in the console.
Any help would be much appreciated!