Error trying to diff '[object Object]' in Angular

前端 未结 4 929
情书的邮戳
情书的邮戳 2020-11-27 20:28

Looks like something wrong with freight variable in HTML:

Error in app/freightList.component.html:13:8 Error trying to diff \'[object Object]\'

4条回答
  •  孤独总比滥情好
    2020-11-27 21:16

    The problem (for me) was in my newState definition. Below is the correct definition:

    const newState = (state, newData) => {
        return Object.assign([], state, newData);
    }
    

    My newState was converting my array to an object because I was using the wrong brackets - the Wrong Way is below.

    const newState = (state, newData) => {
        return Object.assign({}, state, newData);
    }
    

    Good luck, I hope that helps, Rob

提交回复
热议问题