Sunny
Sunny

Reputation: 1215

Displaying Objects in HTML using Angular2

In my component i am getting the json in the variable name peopleDetails

Sample JSON:

{
   name:'xxxx',
   age:123,
   details:{
      qualification:'abc',
      yearofPassing:1111
   }
}

I tried to display it in my html like this

<div>{{peopleDetails.name | async}}

But i cant able to get the property of the json

It is printing the whole json when i tried like this.

<div>{{peopleDetails.name | async | json}}

But i want to access all the properties of the Json.

Upvotes: 1

Views: 1603

Answers (1)

G&#252;nter Z&#246;chbauer
G&#252;nter Z&#246;chbauer

Reputation: 657118

Hard to tell from your question what the problem is. A guess:

<div>{{(peopleDetails | async)?.name}} </div>

Upvotes: 3

Related Questions