Reputation: 905
I have these date objects. I want to bundle them all together and send it across via ajax to backend.
$scope.date1 = Fri Feb 12 2016 12:14:20 GMT-0800 (Pacific Standard Time)
$scope.date2 = Sat Feb 13 2016 12:14:20 GMT-0800 (Pacific Standard Time)
$scope.date3 = Sun Feb 14 2016 12:14:20 GMT-0800 (Pacific Standard Time)
$scope.date4 = Mon Feb 15 2016 12:14:20 GMT-0800 (Pacific Standard Time)
Can someone tell me a way how to do it.
Upvotes: 0
Views: 28
Reputation: 161
An array.
$scope.dates = [$scope.date1, $scope.date2, $scope.date3, $scope.date4];
If you ever find yourself numbering variables, that's a red flag that you should be using an array.
Upvotes: 3