我在尝试使用 Angular 动态显示所有 json 值时遇到问题ng-repat
这是我希望使用硬编码值替换的内容
html
<div ng-repeat="user in users">
{{user.userId}} {{user.userName}} {{user.password}}
</div>
输出
3 DAve password
4 bob password
4 kjdjkdj
1 names password2
我正在尝试将角度重复编写得更通用,这样我就可以从猫鼬模型中传递任意数量的 json 集合。到目前为止我已经得到
<div ng-repeat="(key, value) in users">
<td> {{key}} </td> <td> {{ value }} </td>
</div>
通过这个循环,我得到了太多信息,输出如下
0 {"_id":"527a732fe5f8dabf5b00020c","userId":3,"userName":"DAve","password":"password"}
1 {"userId":4,"userName":"bob","password":"password","_id":"527abf6ebaa5eb8426000001","__v":0}
2 {"userId":4,"password":"kjdjkdj","_id":"527d62fc85612ab42b000001","__v":0}
3 {"__v":0,"_id":"528130182c5544b81f000002","password":"password2","userId":1,"userName":"names"}
如何修改以下循环以仅输出 userName 密码和 userId 而不必像在我的第一个循环中那样显式声明它们。