In Angular sidemenu project
.controller('PlaylistsCtrl', function($scope, $http) {
$scope.basePath = 'http://localhost/iongallery/rest/';
$http({
method: 'POST',
url : $scope.basePath+'ajax_get_data_client.php',
data : {'operation': 'showMonths'}
}).then(function success(data){
$scope.months = data;
console.log($scope.months[1].years);
}, function error(data){
});
When i Load the app 2 request got generated, one without any data {} and one with data {'operation': 'showMonths'} .
The request without any data dosen;t fetch andy response and the request with data fetch
[{"month":"2","years":"2016"},{"month":"3","years":"2016"},{"month":"4","years":"2016"},{"month":"5","years":"2016"}]
this json.
But, while unable to read the JSON.
Give Eror TypeError: Cannot read property 'years' of undefined
