Trying to showcase the contents of object
within an array
.
However, unable to showcase any results. Why is this happening?
This is what I've attempted so far:
Demo available here: https://stackblitz.com/edit/ionic-dsdjvp?file=pages%2Fhome%2Fhome.ts
home.html
<div *ngIf="searchResults.length > 0">
<ion-item *ngFor="let searchResult of searchResults.details">
<ion-avatar item-start>
<!--<img src="img/Rabbit-Cage.jpg"> -->
</ion-avatar>
<h2>searchResult.user_id</h2>
<h3>searchResult.email</h3>
<p>searchResult.token</p>
</ion-item>
</div>
home.ts
export class HomePage {
searchResults = [{
"details": [
{
"user_id": "73",
"email": "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="a8cdc2c9d2c9c6dfc9da9f9f9fe8cfc5c9c1c486cbc7c5">[email protected]</a>",
"token": "217808036f0215fee13aee8925574899"
},
{
"user_id": "94",
"email": "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="a4c1cec5dec5cad3c5d693c0c0d79393e4c3c9c5cdc88ac7cbc9">[email protected]</a>",
"token": "f4e9a701f9dae581ecbc2abf1470f88f"
},
...
}];
constructor(public navCtrl: NavController) {
}
}
Check out my demo https://stackblitz.com/edit/ionic-dsdjvp?file=pages%2Fhome%2Fhome.ts
Please assist, thank you in advance!