1

How should I use *ngfor and table display following data? I tried but get confused.

  <tr *ngFor='let properties.property_detail of properties, let i=index'>
              <td>{{properties.property_detail.name}}</td>

for observable and

return this.httpClient.post('http://localhost:8000/properties',
        {   "name":properties.property_detail.getName(),


{

  "properties":
  [
    {
      "property_details":
      {
        "name":"xyz",
        "email":"[email protected]",
        "mobile":1234567890,
        "id":2
      },
      "property_info":{
        "geo_lat":45.3556,
        "geo_long":13.6576756,
        "property_depth":200,
        "property_rating":4,
        "property_status":sold
      },
        "property_owner":{
          "name":"alex",
          "mobile":8765434568
          },
          "_id":"ftf5yfgty",
          "__v":0
          }
       ]
}
1
  • You should start by reading/watching some form of tutorial. Have you tried the tour of heroes in the angular docs? Commented Feb 6, 2019 at 19:11

1 Answer 1

1

How ngFor works in angular:

    *ngFor='let <element> of <array>; let i=index'

then inside the loop you can access element properties like <element>.name

I agree with @Jota.Toledo. you should try the angular tour of heroes.

And solution to your problem:

    <tr *ngFor='let property of response.properties; let i=index'>
        <td>{{property.property_details.name}}</td>
    </tr>
Sign up to request clarification or add additional context in comments.

1 Comment

In order to improve the quality of your answer, please add some commentary about what this code does and how it solves the original question.

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.