I have code that does this:
$scope.grid.data = null;
However it could be the case that $scope.grid has not yet been defined. If that's the case then how could I avoid trying to do this assignment?
I have code that does this:
$scope.grid.data = null;
However it could be the case that $scope.grid has not yet been defined. If that's the case then how could I avoid trying to do this assignment?
if($scope.grid){
$scope.grid.data = null;
}
Can find more elaborate response here: JavaScript object detection: dot syntax versus 'in' keyword