0

I'm using https://www.npmjs.com/package/angular2-infinite-scroll library to add infinite scroll in my Angular 2 app but I'm getting the following error

enter image description here

w3debugger
  • 1,887
  • 16
  • 21

1 Answers1

0

As each element of array has object like {id: number}, you should be pushing object with id property with number value in it inside array.

array.push({id: i})
Pankaj Parkar
  • 127,691
  • 20
  • 213
  • 279
  • it is showing me the same error if I add string inside the object. e.g. `array = [{ id: 1, title: 'name ' }];` – w3debugger Nov 04 '16 at 20:12
  • @w3debugger what is your actual object structure? – Pankaj Parkar Nov 04 '16 at 20:16
  • `{ id: 1, userImage: 'tracymcgrady-avatar.jpg', userName: 'tracymcgrady', distance: '500m', postImage: 'leaf_iphone_case_hard_plastic.jpg', price: '230 AED', likesCount: 32, postText: 'Leaf iPhone Case Hard Plastic', postTags: ['iphone','case','mobile','phones','macbook'], commentCount: 12, }` – w3debugger Nov 04 '16 at 20:16