I am using AngularJs in my application. I make a http call and getting the response. The response contains an array which I am putting as resultinside the $scope object. I am placing a watch on some attribute and try to access the stored object put inside the $scope object. If I print the result object, I see that it contains the array, but when I try to use the array properties such as length it throws an error. I am also not able to use other array methods such as results.data[0].
Please let me know where I am going wrong. Some code for understanding purpose:
var processResponse = function (result) {
$scope.results = result.data;
}
$scope.$watch('attribute', function(newVal) {
console.log($scope.results.length)
});