angularjs convert variable value as key in json

Convert string value as key in json object


  1. $scope.attVal={"a":"fsdfsdfsd","b":"asdfas","c":"asdfas","d":"","e":"fas","f":"asd","g":"","h":"","i":"","j":"","k":""};

  2. $scope.selectedAttribute="a";
  3. $scope.attrValue="asdda";
  4. $scope.attVal[$scope.selectedAttribute]=$scope.attrValue;

In this example you can see, we are converting a string variable into a json key. and Updating old json by key.

Comments

Popular posts from this blog

I get wrong characters when retreiving the message body of an email using TIdIMAP4.UIDRetrieveTextPeek2()

How to drop the all the 1's in a correlation matrix

Today Walkin 14th-Sept