I have a global variable set via a model.
Its in JSON format.
I need to get to the value of the JSON object, not for the UI, but for custom code.
This is the value I am saving in the model variable JSON
{"expiry":"2018-04-23T21:51:46.816+01:00","merchantSessionKey":"415E555465-8475-4498-88E7-7A0703nhE4B5E"}
How do i get the merchantSessionKey from the model?
I'm setting the variable via this, from a service response:
Code: Select all
var MerchantKey_scope = $scope.MerchantKey;
_.set(MerchantKey_scope, 'MKey', success.data.requestParams);
MerchantKey_scope = success.data;
$scope.MerchantKey = MerchantKey_scope;
When i try this $scope.MerchantKey, i get [object object]
I've tried $scope.MerchantKey.merchantSessionKey
I've tried $scope.MerchantKey['merchantSessionKey']
I've tried $scope.MerchantKey.MKey
Ive tried json parse
I've tried json stringify
What am i doing wrong?