I have a method that gets data from service (api). results.component.ts
showResult(){
this.searchService.showSearch().subscribe((res => {
this.dataList = res;
console.log(this.dataList);
}));
}
The data is in the following format. For a better overview I attach url with Json.
[,…]
0: {id: "12", id_user: "20", search_phrase: {searchWords: "erotika"}, set_date: "2019-12-15 19:33:14",…}
id: "12"
id_user: "20"
search_phrase: {searchWords: "erotika"}
set_date: "2019-12-15 19:33:14"
search_sent: "2019-12-15 22:21:48"
results_returned: null
last_result_date: null
search_active: "1"
remote_id: "5df6a3edb1824b0017766a07"
search_data: {data: [{header: "Atlas Erotika - Follow (Official Video) - YouTube",…},…]}
data: [{header: "Atlas Erotika - Follow (Official Video) - YouTube",…},…]
0: {header: "Atlas Erotika - Follow (Official Video) - YouTube",…}
1: {header: "Atlas Erotika - Mećava (Official Lyric Video) - YouTube",…}
2: {header: "Erotika (Video 1994) - IMDb",…}
3: {header: "erotika: Movies & TV - Amazon.com",…}
4: {header: "erotika - Wiktionary", url: "https://en.wiktionary.org › wiki › erotika",…}
5: {header: "#erotika hashtag on Twitter", url: "https://twitter.com › hashtag › erotika",…}
6: {header: "#erotika hashtag on Instagram • Photos and Videos",…}
7: {header: "Atlas Erotika Lyrics, Songs, and Albums | Genius", url: "https://genius.com › A",…}
8: {header: "Atlas Erotika – EXIT Festival 2020",…}
9: {header: "Erotika Biblion Society - Wikipedia",…}
1: {id: "13", id_user: "20", search_phrase: {searchWords: "hokej pardubice"},…}
2: {id: "14", id_user: "20", search_phrase: {searchWords: "Tomas Kalanek"},…}
3: {id: "15", id_user: "20", search_phrase: {searchWords: "praha"}, set_date: "2019-12-15 21:13:52",…}
4: {id: "16", id_user: "20", search_phrase: {searchWords: "East 17"}, set_date: "2019-12-15 21:13:54",…}
I need to get all the header from this format
First my idea was
<ion-list>
<ion-item *ngFor="let post of dataList">
{{ post.search_data.data.header}}
</ion-item>
</ion-list>
But its not working. List is empty.
Thank you for any advice.