1

Image of JSON

I have a json structure like the image above.

I just want to get the value from the key name.

I was do Like this :

<span *ngFor="let outlet of products.body | keyvalue">{{outlet.value}}</span>

but that way is to call all attributes, I only want to call attribute name. how do?

Sorry for bad grammar, any suggestion or answer will be appreciate. Thank you

1
  • 1
    i think that you don't need for ngFor on this JSON structure because it's not an array , so you can get the value directly using {{body.name}} , and if you have multi products so ngFor will be for the parent not for this section specially Commented Oct 20, 2020 at 10:27

2 Answers 2

5

If you only want to get the value of name key, there is no need to use *ngFor.

It's enough to put it directly as follows.

<span>{{ products?.body?.name }}</span>
Sign up to request clarification or add additional context in comments.

Comments

1

Please bind

{{outlet.name}}

instead of {{outlet.value}}

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.