My current issue involves using $watch for pagination on my page. Unfortunately, the data is not appearing until I click on one of the buttons.
Below is the relevant code snippet:
.controller('AppCtrl', function ($scope, $modal, Faq) {
$scope.filteredFaqData = [];
$scope.currentPage = 1;
$scope.numPerPage = 5;
$scope.maxSize = 5;
$scope.faqData = [];
$scope.faqData = Faq.getFaqs();
$scope.$watch('currentPage + numPerPage', function () {
var begin = (($scope.currentPage - 1) * $scope.numPerPage)
, end = begin + $scope.numPerPage;
$scope.filteredFaqData = $scope.faqData.slice(begin, end);
});
})
In this setup, the data is retrieved in $scope.faqData from the service. However, the $scope.filteredFaqData remains empty until I actually interact with the paging tabs.