Achieve displaying 6 pieces of data per page, but the first piece of data is not displayed, start directly from the second piece
index starts from 0
In fact, you can just change ng-if to write like this: ng-if="$index <= pagenum * 6 && $index >= (pagenum - 1) * 6"
ng-if="$index <= pagenum * 6 && $index >= (pagenum - 1) * 6"
$index is 0, the first condition is met, so the return value is the second condition. And 0 is not greater than 0, so return false
$index
If you are writing pagination, consider using filter 写可能会比较好,不需要用 ng-if
filter
ng-if
In addition, it is customary to process data, such as your txt.split('|'), in the controller, rather than in html.
txt.split('|')
index starts from 0
In fact, you can just change ng-if to write like this:
Whenng-if="$index <= pagenum * 6 && $index >= (pagenum - 1) * 6"
$index
is 0, the first condition is met, so the return value is the second condition. And 0 is not greater than 0, so return falseIf you are writing pagination, consider using
filter
写可能会比较好,不需要用ng-if
In addition, it is customary to process data, such as your
txt.split('|')
, in the controller, rather than in html.