0

Hello I'm trying to concat two JSON object to form a bigger json body. both these objects are form values which are assigned to a rootscope variable.

$rootScope.AString = angular.toJson(AModel);
    $rootScope.BString = angular.toJson(BModel);
    $rootScope.CString = BString.concat(AString);

But this does not work! I searched through all the documentation. there is no clear function to do this. please help!

1 Answers1

0

You can try this by using spread operator(es6), you will get the combined object of AModel and BModel at $rootScope.CModel.

$rootScope.CModel = {...$rootScope.AModel, ...$rootScope.BModel};
Amaldev ps
  • 257
  • 2
  • 12