I'm trying to push the 'currentBall' object into the 'currentOver.balls' array
$scope.currentOver.balls.push($scope.currentBall);
The current state of both objects just before the above code is run (from the dev tools):
$scope.currentOver: Array[1]
0: Object
balls: Array[0]
bowlerId: 0
byes: 0
legByes: 0
noBalls: 0
runs: 0
wickets: 0
wides: 0
__proto__: Object
length: 1
overId: 1
__proto__: Array[0]
$scope.currentBall: Object
ballId: 0
batsmanId: 0
bowlerId: 0
byes: 0
legByes: 0
noBalls: 0
runs: 2
wicketsNumber: 0
wicketsType: 0
wides: 0
__proto__: Object
I get an error: Cannot read property 'push' of undefined. But it's clear that the '$scope.currentOver.balls' array is defined, so what's going on here?