Reputation: 735
My data structure is:
{"code":"AAA","name":"AAA industries","date":null}
I am trying to display just the name in a button. I am trying to use the following:
<div ng-repeat="item in company.details">
<button ng-repeat="(key, val) in item">
{{val}}
</button>
</div>
but of course that displays everything. What's my next step here?
Upvotes: 1
Views: 2085
Reputation: 901
Kolban is correct. So in your case the answer would be:
<div ng-repeat="item in company.details">
{{item.val}}
</div>
Upvotes: 0
Reputation: 15246
Here is a jsBin illustrating an answer.
The code logic is as follows:
<body ng-app="MyApp" ng-controller="myController">
<div ng-repeat="item in data">
{{item.name}}
</div>
</body>
Upvotes: 0
Reputation: 20445
use this
check for key, if it is equal to name then display else dont
<div ng-repeat="item in company.details">
<button ng-repeat="(key, val) in item">
<span ng-if="key=='name'">{{val}}</span>
</button>
</div>
Upvotes: 2