简体   繁体   中英

how to get a item inside item in html angular js?

I tried get a value from both dynamic objects in angular js

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

inside SampleController

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

right now I put item['111']['price'] statically. 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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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