Thursday, 15 August 2013

Getting an error message when trying to push to an array

Getting an error message when trying to push to an array

I have the following code:
if (typeof $scope.grid.data == 'undefined') {
$scope.grid.data = [];
}
$scope.grid.data.push(result);
I put in the check for undefined but I am still getting an error message
from the push saying:
TypeError: Cannot call method 'push' of null
Any advice would be much appreciated

No comments:

Post a Comment