0

I want to print a value => id of an array which looks like this:

locations = [
    {id: '1',  lat: 51.5239935252832,    lng:  5.137663903579778,   content: 'Kids Jungalow (5p)'},
    {id: '2',  lat: 51.523853342911906,  lng:  5.1377765563584035,  content: 'Kids Jungalow (5p)'},
    {id: '3',  lat: 51.5237298485607,    lng:  5.137969675407476,   content: 'Kids Jungalow (5p)'},
    {id: '4',  lat: 51.52355628836575,   lng:  5.138066234932012,   content: 'Kids Jungalow (5p)'},
    {id: '5',  lat: 51.52340275379578,   lng:  5.138211074218816,   content: 'Kids Jungalow (5p)'},
    {id: '6',  lat: 51.523199152806626,  lng:  5.138382735595769,   content: 'Kids Jungalow (5p)'},
    {id: '7',  lat: 51.5229955509073,    lng:  5.138511481628484,   content: 'Kids Jungalow (5p)'},
];

and in my html template I am writing this: <h1 *ngFor="#location of locations">{{locations.id}}</h1>

But it is not showing what is wrong?

1 Answer 1

2

//check you are creating local variable location

<h1 *ngFor="#location of locations">**{{location.id}}**</h1>
Sign up to request clarification or add additional context in comments.

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.