$scope.objectData = {};
$scope.objectData[key]["digits"] = set.first+','+set.second+','+set.third+','+set.fourth;
here key is a numerical value.The error is
TypeError: Cannot set property 'digits' of undefined
$scope.objectData = {};
$scope.objectData[key]["digits"] = set.first+','+set.second+','+set.third+','+set.fourth;
here key is a numerical value.The error is
TypeError: Cannot set property 'digits' of undefined
You need to set the value of $scope.objectData[key]
to an object before you can add more keys to it.
$scope.objectData[key] = {};
$scope.objectData[key]['digits'] = 'foo';
You first have to initalize the object $scope.objectData[key]
so the right code would be:
$scope.objectData = {};
$scope.objectData[key] = {};
$scope.objectData[key]["digits"] = set.first+','+set.second+','+set.third+','+set.fourth;