简体   繁体   English

如何在html角js中获取项目内的项目?

[英]how to get a item inside item in html angular js?

I tried get a value from both dynamic objects in angular js 我试图从angular js中的两个动态对象获取值

<div ng-controller="SampleController">
<div> {{item['111']['price']}}
</div>

inside SampleController 在SampleController内部

$scope.item={111:{price:"232"},112:{price:"233"},115:{price:"237"}};

right now I put item['111']['price'] statically. 现在我静态放置item ['111'] ['price']。 if when i receive the value dynamically from some where else how to that. 如果当我从其他地方动态接收值时,该如何做。 Like, 喜欢,

<div ng-controller="SampleController">
<div> {{item[{{ItemId['id']}}]['price']}}
</div>

$scope.ItemId={id:111};
$scope.item={111:{price:"232"},112:{price:"233"},115:{price:"237"}};

But its returning error. 但是它的返回错误。 I tried with route scope also.Any one please help out. 我也尝试了路线范围。任何人都可以帮忙。

尝试这个:

<div>{{item[ItemId.id].price}}</div>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM