locked
Cannot find a differ supporting object '[object Object]' of type 'object'. NgFor only supports binding to Iterables such as Arrays RRS feed

  • Question

  • User696604810 posted

    I work on angular 7 when i run my app i get error
    ReportdetailsComponent.html:39 ERROR Error: Cannot find a differ supporting object '[object Object]' of type 'object'. NgFor only supports binding to Iterables such as Arrays.
    at NgForOf.ngDoCheck (common.js:4841)
    at checkAndUpdateDirectiveInline (core.js:31913)
    at checkAndUpdateNodeInline (core.js:44367)
    at checkAndUpdateNode (core.js:44306)
    at debugCheckAndUpdateNode (core.js:45328)
    at debugCheckDirectivesFn (core.js:45271)
    at Object.eval [as updateDirectives] (ReportdetailsComponent.html:48)
    at Object.debugUpdateDirectives [as updateDirectives] (core.js:45259)
    at checkAndUpdateView (core.js:44271)
    at callViewAction

    (core.js:44637)
    my component reportdetails.html

    class="row" #TABLE #table> 
    class="col-12 table-responsive" > 
    
    
    
    
    
    
    
    class="table-responsive table-container" style="margin-right:200px;"> 
    
    class="table table-bordered"> 
    class="thead-dark"> 
    
    "let coln of headerCols"> 
    {{coln}} 
    
    
    
    
    
    
    
    "let repdata of ReportData"> 
    "let rep of contentBody"> 
    
    "let r1 of rep">{{r1}} 
    
    "repdata.inRunTime==0 && repdata.parameterName !==null && repdata.downloadProcedureName !==null"> "getDataByRevision(rep[0])">Download 
    
    
    
    
    
    
    




    and component report details.ts

    reportdetailslist: any[]; 
    headerCols: string[] = []; 
    contentBody: any[] = []; 
    reportList: any[] = []; 
    ReportData:any={}; 
    
    this._displayreport.GetsubReportsById(param2).subscribe((data3: any) => { 
    this.ReportData = data3; 
    console.log("databyid" + JSON.stringify(this.ReportData) ); 
    }); 
    
    console.log("data " + this.searchData); 
    this._displayreport.GetReportDetailsByReportId(param2).subscribe((data: any[]) => { 
    
    this.reportdetailslist = data; 
    
    
    this.headerCols = Object.keys(data[0]); 
    data.forEach((item) =>{ 
    let values = Object.keys(item).map((key)=> item[key]); 
    this.contentBody.push(values); 
    
    
    }); 
    lines have error 38 and 48 reportdetailscomponet.html as following
    38 
    
    "let coln of headerCols"> 
    48 
    "let repdata of ReportData"> 



    so How to solve problem


    so How to solve problem

    Saturday, May 9, 2020 3:21 PM

All replies

  • User303363814 posted

    Can you use the 'Preview' button before your post your question?  Most of it is missing.  From the little bit I can see ReportData is not an Array

    Sunday, May 10, 2020 10:47 PM