krish
krish

Reputation: 1117

How to store multiple scope objects in a single scope

I have 2 scope objects.

$scope.aaa;
$scope.bbb;

I want to pass it as list to backend.so I tried to store in single object.

$scope.fullData={$scope.aaa,$scope.bbb}

I tried to console $scope.fullData.Its showing some red color error line in dot of both objects.

How can I send it as single object/array/list?

Upvotes: 1

Views: 75

Answers (2)

Sachila Ranawaka
Sachila Ranawaka

Reputation: 41447

change the curly brackets to square brackets if you want to send an array

$scope.fullData=[$scope.aaa,$scope.bbb]

Upvotes: 1

Stephen Gilboy
Stephen Gilboy

Reputation: 5825

Add property names to make it a valid object.

$scope.fullData = {
  aaa: $scope.aaa,
  bbb: $scope.bbb
}

Upvotes: 2

Related Questions