这一定很简单,Angular可能有一个内置的指令来做到这一点,但我不知道如何不通过数组循环。AngularJS通过匹配ID访问更多详细信息
我有一个选项阵列,即
$scope.colors=[
{id:"0",label:"blue"},
{id:"1",label:"red"},
{id:"2",label:"green"}
]
然后存储颜色选项即
$scope.data={
color:"1",
otherproperty:""
}
的ID我的数据对象,但是当我显示的数据我希望用户显示标签,而不是ID,那么有没有一个简单的(角度)的方式来做到这一点?:
{{data.color.label}}
这将是很好把一些HTML代码。或者你做了什么的小提琴 – kiro112