gpt4 book ai didi

Angular 9 : List user details on GUI

转载 作者:行者123 更新时间:2023-12-04 09:40:42 25 4
gpt4 key购买 nike

我想使用 angular 列出在页面上注册的用户。

API响应:

{
"message": "User list is fetched successfully",
"result": [
{
"firstName": "xcvbn",
"lastName": "fvbnm",
"domain": "hgj"
},
{
"firstName": "wdD",
"lastName": "DWQ",
"domain": "hDWgj"
},
{
"firstName": "GH",
"lastName": "J",
"domain": "RF"
},
{
"firstName": "D",
"lastName": "F",
"domain": "K"
}
],
"status": true,
"responseCode": "200"
}

我能够获得 API 响应,但无法在 UI 上显示列表。这是我为列出用户列表而创建的 component.html 类
**component.html**

<div class="container">
<div class="container">
<div class="container">
<div class="row col-md-6 col-md-offset-2 custyle">
<table class="table table-striped custab">
<thead>
<tr>
<th>Frist Name</th>
<th>Last name</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let user of users">
<td>{{user.firstName}}</td>
<td>{{user.lastName}}</td>
</tr>
</tbody>
</table>
</div>
</div>

最佳答案

尝试将您的 html 更改为

<div class="container">
<div class="container">
<div class="container">
<div class="row col-md-6 col-md-offset-2 custyle">
<table class="table table-striped custab">
<thead>
<tr>
<th>Frist Name</th>
<th>Last name</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let user of users.result">
<td>{{user.firstName}}</td>
<td>{{user.lastName}}</td>
</tr>
</tbody>
</table>
</div>
</div>

关于 Angular 9 : List user details on GUI,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62349555/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com