"how to convert string to object in angularjs " Code Answer

3

you can do it with angular.fromjson()

in your sample, it would have been $scope.tmp = angular.fromjson($scope.text);

the difference between json.parse() and angular.fromjson, is that angular will check to make sure a string is provided. if it is already an object, it will return the same object.

By Daniel H-M on April 3 2022

Answers related to “how to convert string to object in angularjs ”

Only authorized users can answer the Search term. Please sign in first, or register a free account.