Next data list with active index.
npm install -S @jswork/next-activeable-data-list
api | params | description |
---|---|---|
get | - | Get current active item. |
to | - | Go to the input index. |
next | - | Go to next index. |
prev | - | Go to previous index. |
first | - | Go to first index. |
last | - | Go to last index. |
{ activeIndex: 0, continuous: false }
import NxActiveableDataList from '@jswork/next-activeable-data-list';
const items = [
"item1",
"item2",
"item3",
"item4",
"item5",
"item6",
"item7",
"item8",
"item9",
];
const list = new NxActiveableDataList();
list.next(); // 1
list.next(); // 2
list.prev(); // 1
list.prev(); // 0
Code released under the MIT license.