angular - 无法使用 ngfor ANGULAR 在 html 中获取值
问题描述
我有一个数组,它存储了所有这些数据
Form values: {
"employees": [
{
"firstName": "R",
"lastName": "B",
"repeat_sun": true,
"repeat_mon": true,
"repeat_tue": false,
"skills": [
{
"skill": "JAVA",
"exp": "2"
}
],
"userdays": [
"Sun",
"Mon"
]
}
]
}
我已将这些值存储在 tempArray 中,并在我的 html 中访问它
模板
<table class="table table-bordered">
<thead>
<tr>
<th scope="col">first name</th>
<th scope="col">last name</th>
<th scope="col">skill and exp</th>
<th scope="col">days</th>
</tr>
</thead>
<tbody>
<tr
*ngFor="let details of tempArray"
id="{{ details.empIndex }}">
<td> {{ details.firstName }}</td>
<td>{{ details.lastName }}</td>
<td> <span *ngFor="let data of details.skills">
{{ data.skill }} and {{ data.exp }},
<br />
</span>
</td>
<td> <span *ngFor="let data of details.userdays">
{{ details.userdays}}
<br />
</span>
</td>
</tr>
</tbody>
</table>
我能够显示所有值,但是 userdays...我需要显示 userdays vals
解决方案
推荐阅读
- python - For Loop 和 Pandas - 从列表或变量中设置属性
- android - 如何知道 gradle , android studio 用于构建 android app
- facebook - Azure BotFramework V4 可以获取 facebook webhook 页面提要事件吗?
- cassandra - Cassandra nodetool 状态下降并且生成时间很旧
- javascript - 在 rails activeadmin 中渲染表单部分而不使用 formtastic 表单
- python - 将许多python变量的列表保存到excel表中,同时保持变量类型的定义?
- flutter - Flutter 中的 MDNS 支持
- c++ - 如何将对象放入`std::tuple`并使用仅移动操作获取第一项?
- android - Android / 阅读所有活动状态栏通知
- ruby-on-rails - 将 ruby 哈希转换为 yaml 时缩进不当