Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 48980

Problem: NgFor only supports binding to Iterables such as Arrays

$
0
0

Hello,

I am trying to get data from reqres.in and showing list user on the home page but getting that error after ngfor.

image

This is my home.page.ts code:

import { Component } from '@angular/core';
import { Plugins } from '@capacitor/core';
import { Router } from '@angular/router';
import { HttpClient } from '@angular/common/http';



const { Storage } = Plugins;

@Component({
  selector: 'app-home',
  templateUrl: 'home.page.html',
  styleUrls: ['home.page.scss'],
})
export class HomePage {

  veriler:any;

  adres:any = 'https://reqres.in/api/users?page=2';

  constructor(private router:Router, public http:HttpClient) {
    this.veriAl();
    
  }

  veriAl(){

    this.http.get(this.adres).subscribe(sonuc=>{this.veriler=sonuc; console.log(this.veriler)}, hata=>{console.log(hata)});
   
  }


  async removeItem(item) {
    await Storage.remove({ key: item });
  }


  

  logout()
  {

    this.removeItem('user_ionichttpAuth');
    this.router.navigateByUrl('/login');

  }

}

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 48980

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>