sireesha siri

sireesha siri

  • NA
  • 4
  • 1.5k

Go by Value in JSON in precise?

Feb 2 2018 8:32 AM
Hi,
 
I have watched an interesting conduct in JSON,
 
Give me a chance to endeavor to depict situation, we have one rakish degree variable say
 
$scope.regValue = 0;
 
This is instated in the controller and utilized under ngModel in HTML layout to find an adjustment in esteem.
 
Presently Let's allocate this to JSON protest key,
 
var jsonObj = { 'key1': $scope.regValue };
 
What I have watched is, presently
 
jsonObj['key1']
 
the esteem will be 0, which is Correct.
 
Yet, when ngModel changes the estimation of $scope.regValue, It isn't reflected in JSON key esteem, which implies
 
jsonObj['key1']
 
is as yet equivalent to 0.
 
While $scope.regValue has effectively changed.
 
Is this conduct expected, Or Pass by reference can't pass its own reference to another variable?
 
Thanks and Regards,
Sireesha

Answers (1)