My Data has 2 offices and another has one office
"id": "1",
"username": "test",
"groups": "Admin",
"office": [
{
"officeid": "2",
"officename": "moon"
},
{
"officeid": "3",
"officename": "stars"
}
]
}, "id": "2",
"username": "john",
"groups": "guest",
"office": [
{
"officeid": "2",
"officename": "moon"
}
]
}
I want to display the office to textbox. If the data has 1 office, I should only display one textbox showing the office name and if the data has 2 offices, I should display 2 offices in a textbox.
<div class="form-group row">
<label class="col-md-2 control-label" for="text-input">Office</label>
<div class="col-md-4">
<label class="form-control underline"> {{(allUserData.office == "" ? "--No data--" : allUserData.office)}} </label>
</div>
</div>
How should I display this in html. The above is my current html. I have tried to look at other *ngFor methods. They all seem not to work or I might have done it wrong. What is the proper way to retrieve the data? Thank you.