I can't fetch data on ionic app page by HTTP API. data only showing in console but not showing in ionic app page on display. please help me to find out the error

I am having some problem on ionic. I am not able to display data on screen via http in ionic.
i only showing data on google console.

this is the code of the file.

home.page.html (home page code)*


<ion-item *ngIf=“users”>

home.page.ts (ts file code)*

import { Component } from ‘@angular/core’;
import { NavController } from ‘@ionic/angular’;
import { HttpClientModule } from ‘@angular/common/http’;
import { HttpClient } from ‘@angular/common/http’;

selector: ‘app-home’,
templateUrl: ‘home.page.html’,
styleUrls: [‘home.page.scss’],
export class HomePage {

users: any=;

public navctrl: NavController,
public httpclient: HttpClient,
public httpclientmodule: HttpClientModule
) {
getdata() {
(data) => {
this.users = [data];
(error) => {

Output screen

It looks like you’re not iterating through the data. Try something like this in your html.

<ion-list  *ngIf=“users”>
    <ion-item *ngFor="#item of users">
        Username: {{item.username}}

1 Like

i already do this in my code but never working.

hi, this.users = [data]; ← something wrong with this line ? try remove ?

1 Like

if you want to access each element given that your objects are stored in an array … you can simply do to access the i element

example : users[0].username --> Bret

or remove → this.users = data