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

后端 未结 18 1243
逝去的感伤
逝去的感伤 2020-11-29 05:50

I looked at similar questions, but none of them helped me. I am going to receive an object like the following:

[
  {
    \"id\": 1,
    \"name\": \"Safa\",
          


        
18条回答
  •  情书的邮戳
    2020-11-29 06:05

    *********** PARSE THE RESULT TO JSON OBJECT: JSON.prase(result.arrayOfObjects) ***********

    I came to this page after I faced this issue. So, my issue was that the server is sending array of objects in the form of string. It is something like this:

    when I printed result on console after getting from server it is string:

    'arrayOfObject': '[
                      {'id': '123', 'designation': 'developer'},
                      {'id': '422', 'designation': 'lead'}
                   ]'
    

    So, I have to convert this string to JSON after getting it from server. Use method for parsing the result string that you receive from server:

    JSON.parse(result.arrayOfObjects)
    

提交回复
热议问题