I've encountered an issue with the controller that was previously functioning normally. The error message I'm getting points to line 23. (TypeError: Cannot read property 'length' of undefined)
$scope.filteredItems = $scope.list.length;
Below is the complete script:
var appMembers = angular.module('myAppMembers', ['ui.bootstrap']);
appMembers.filter('startFrom', function() {
return function(input, start) {
if(input) {
start = +start; //parse to int
return input.slice(start);
};
return [];
}
});
appMembers.controller('membersCrtl', function ($scope, $http, $timeout) {
$http({method: "GET", url: "../angularJS/ajax/getMembers.php"})
.then(function onSuccess(response) {
var members = response.members;
var status = response.status;
var statusText = response.statusText;
var headers = response.headers;
var config = response.config;
$scope.list = members;
$scope.currentPage = 1; //current page
$scope.entryLimit = 50; //max no of items to display in a page
$scope.filteredItems = $scope.list.length; //Initially for no filter
$scope.totalItems = $scope.list.length;
})
.catch(function onError(response) {
var members = response.members;
var status = response.status;
var statusText = response.statusText;
var headers = response.headers;
var config = response.config;
console.log(response);
});
$scope.setPage = function(pageNo) {
$scope.currentPage = pageNo;
};
$scope.filter = function() {
$timeout(function() {
$scope.filteredItems = $scope.filtered.length;
}, 10);
};
$scope.sort_by = function(predicate) {
$scope.predicate = predicate;
$scope.reverse = !$scope.reverse;
};
});
The file paths and names (appMembers, myAppMembers) are verified correct.
Your assistance with this issue would be greatly appreciated.