2017-09-30 4 views
-1

I ERROR Error: Cannot find a differ supporting object '[object Object]' of type 'object'. NgFor only supports binding to Iterables such as Arrays.unterscheiden Objekt unterstützt '[object Object]' vom Typ

ts Datei bin immer:

this.list = data.json(); 
    console.log("=====>"+JSON.stringify(this.list)); 

Listendaten:

=====>{"CorpBusiness":[{"cpbusid":437,"cpbuscpcdid":18315,"cpbuscpliid":1,"cpbus_cin_no":null,"cpbus_industry":1001,"cpbus_score":0,"cpbus_loantaken":1,"cpbus_delayed":36,"cpbus_exdraws":42,"cpbus_trans":45,"cpbus_prop_ownship":0,"cpbus_createdby":null,"cpbus_createdon":null,"cpbus_updatedby":null,"cpbus_updatedon":null,"cpbus_auth_creditchk":"u","cpbus_prop_type":0,"cpbus_market_val":0,"cpbus_loan_on_prop":0,"cpbus_payment_hist":33}],"CorpFinancial":[{"cpfinid":973,"cpfincpdtid":18315,"cpfinliid":1,"cpfin_yr":"2","cpfin_type":"1","cpfin_acrrev":75678,"cpfin_totcurrent_assets":765657656,"cpfin_curr_liabilities":0,"cpfin_totliabilities":0,"cpfin_dep":0,"cpfin_intpaid":0,"cpfin_createdby":null,"cpfin_createdon":null,"cpfin_updatedby":null,"cpfin_updatedon":null,"cpfin_intg_assets":32432,"cpfin_tot_networth":0,"cpfin_netprof_beftax":0,"cpfin_netsales":0,"cpfin_ord":1},{"cpfinid":974,"cpfincpdtid":18315,"cpfinliid":1,"cpfin_yr":"2","cpfin_type":"4","cpfin_acrrev":111,"cpfin_totcurrent_assets":12121,"cpfin_curr_liabilities":7676,"cpfin_totliabilities":76676,"cpfin_dep":43543,"cpfin_intpaid":4343,"cpfin_createdby":null,"cpfin_createdon":null,"cpfin_updatedby":null,"cpfin_updatedon":null,"cpfin_intg_assets":121232,"cpfin_tot_networth":6576765,"cpfin_netprof_beftax":5656,"cpfin_netsales":543523,"cpfin_ord":2},{"cpfinid":975,"cpfincpdtid":18315,"cpfinliid":1,"cpfin_yr":"3","cpfin_type":"4","cpfin_acrrev":7876,"cpfin_totcurrent_assets":7565677,"cpfin_curr_liabilities":5456,"cpfin_totliabilities":5676,"cpfin_dep":435,"cpfin_intpaid":5435576,"cpfin_createdby":null,"cpfin_createdon":null,"cpfin_updatedby":null,"cpfin_updatedon":null,"cpfin_intg_assets":8909854,"cpfin_tot_networth":231,"cpfin_netprof_beftax":65756754,"cpfin_netsales":45,"cpfin_ord":3}],"LoanInfo":[{"li_id":null,"li_amt":2000000,"li_createdon":null,"li_createdby":null,"li_updatedon":null,"li_updatedby":null,"li_cp_version_id":null,"li_pg_id":0,"corpDetails":null}]} 

Meine html:

<td class="amtformatdis text-right" *ngFor="let model of list;let i = index" name="selection"> 
    <input type="text" name="cpfin_intg_assets{{i}}" [(ngModel)]="model.cpfin_intg_assets"/>           
</td> 
+0

ngFor funktioniert nicht auf Objekte, und die Liste ist ein Objekt, kein Array . Ich glaube, Sie meinten, tun '* ngFor =" Lassen Sie Modell von list.CorpBusiness " –

Antwort

0

Wie der Fehler sagt ngFor nicht auf Objekten arbeiten, ich glaube, Sie die CorpFinancial zugreifen müssen, die eine ist array,

<td class="amtformatdis text-right" *ngFor="let model of list.CorpFinancial;let i = index" name="selection"> 
<input type="text" name="cpfin_intg_assets{{i}}" [(ngModel)]="model.cpfin_intg_assets"/> 
+0

danke. Ich erhalte ERROR TypeError: Kann Eigenschaft 'CorpBusiness' von undefined nicht lesen –

+0

versuchen Sie diese * ngFor =" Modell der Liste? .CorpBusiness ?. CorpFinancial – Sajeetharan

+0

danke..kein Fehler in der Konsole. aber ich kann nicht wert {{model.cpbuscpcdid}} –

Verwandte Themen