In my component.ts file, I have retrieved this data from an API call:
[
[
{
"name": "name one",
"desc": "something here",
},
{
"name": "name two",
"desc": "something here",
},
{
"name": "another name",
"desc": "something here",
}
]
]
I then assign it to my component.html using the following code:
this.mydata = [result];
The array [result] contains the aforementioned data.
Next, I implement a select element:
<select name="list">
<option *ngFor="let data of mydata; value="{{ data.name }}">{{ data.name }}</option>
</select>
However, the issue I am facing is that the select element does not display any names.
To troubleshoot, I added the line: {{ mydata | json }}
and confirmed that the data is indeed present as shown above.
How can I resolve this problem?