//Separates the itemArray into pages so that we can 'flip' through them
$scope.createPages = function (itemArr, pageSize) {
var pages = [];
var itemCount = 0;
var currPage;
itemArr.forEach(function (item) {
itemCount++;
var index = itemCount % pageSize;
if (index == 1) {
//Create a new page, and append it to the pages
currPage = [];
pages.push(currPage);
}
currPage.push(item);
});
return pages;
}