0
我使用https://www.npmjs.com/package/angular2-infinite-scroll庫在我的角2應用程序添加無限滾動,但我發現了以下錯誤angular2無限滾動 - 數字類型的說法是不能分配給字符串類型的參數
我使用https://www.npmjs.com/package/angular2-infinite-scroll庫在我的角2應用程序添加無限滾動,但我發現了以下錯誤angular2無限滾動 - 數字類型的說法是不能分配給字符串類型的參數
由於array
每一個元素都有對象像{id: number}
,你應該推object
與id
屬性裏面array
它number
值。
array.push({id: i})
它顯示我同樣的錯誤,如果我在對象中添加字符串。 例如'array = [{id:1,title:'name'}];' – w3debugger
@ w3debugger什麼是您的實際對象結構? –
'{ ID:1, userImage: '崔西·麥葛雷迪-avatar.jpg', 用戶名: '崔西·麥葛雷迪', 距離: '500米', postImage: 'leaf_iphone_case_hard_plastic.jpg', 價格: '230 AED', likesCount:32, postText: '葉iPhone案例硬塑料', postTags:[ 'iphone', '殼體', '移動', '電話', '的MacBook'], commentCount:12, }' – w3debugger