gpt4 book ai didi

javascript - 用 AngularJS 表中的值替换集合的 ID

转载 作者:行者123 更新时间:2023-11-29 19:03:06 25 4
gpt4 key购买 nike

我需要在 AngularJS 表中使用“枚举”的文本值(我在这里使用智能表,但它可以是任何东西)

我的枚举是这样的:var team = { "0": "Alpha", "1": "Beta", "2": "Gamma"};

我的就像{id: personId, firstName: "string",..., team: teamId}

enter image description here

这里是 my CodePen

所以,从 Person 的一部分我有 teamID,从另一部分我可以得到 Teams json ({ "0": "Alpha ", "1": "Beta", "2": " Gamma ")

如何“加入”该信息以在表格中显示团队名称?

更一般地说,问题如下:

I have a collection of objects A that contains IDs of object B. I need to display in the A collection table the B Name instead of the B Id...

最佳答案

用这个替换第 29 行的代码..

var mood = moods[Math.round(Math.random()).toString()];

关于javascript - 用 AngularJS 表中的值替换集合的 ID,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45348528/

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