1

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?

3 Answers 3

2

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>
Sign up to request clarification or add additional context in comments.

Comments

0

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>

Comments

0

Kolban is correct. So in your case the answer would be:

<div ng-repeat="item in company.details"> {{item.val}} </div>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.