如何从元素行访问特定值
在角材料表中,我们需要制作这样的数据结构:
{personne:ali,applicationx:10,applicationy:20,applicationz:30}
但是就我而言,我有类似的数据:
{“ ali”:[{“ nameOfapp”:“ applicationx”,“ valueofapp”:10},{“ nameofapp”:“ applicationy”,“ valueofapp”:20},{“ nameofapp”:“:” applicationz”,“ valueofapp”:30}]}
在TD标签中:< td Mat-cell *matcelldef =“ let element”>元素| json}}}
显示整个行的结果:
在我的情况下,我想显示特定的值
valueOfApp from ApplicaitonY (20)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
“简单响应”是,
但我认为您应该改变数据。
首先,您可以在数据中获取所有不同的“应用程序”
,可以使用Reald和过滤以删除重复元素
或使用新集合
,然后您以方式转换数据
,因此您具有具有属性的一系列元素:“ personne”和不同的应用程序名称
请参见a little stackblitz (我定义时创建变量,通常您需要声明,并且在功能中,您获得数据为它们提供了值)
The "easy response" is
But I think you should transform your data.
First you get all the differents "applications" based in your data
You can use reduce and filter to remove the duplicate elements
Or using new Set
Then you transform your data in the way
So you has an array of elements with the properties: "personne" and the differents appsNames
See a little stackblitz (I create the variables when I defined, in general you need declare and, in the function you get the data give value to them)