Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular http get returns string in extra quotes

My project is a mixture of AngularJS and ASP.Net MVC.

I am using $http.get to call my api controller, which returns a string. But in the .success function, the data is getting returned like so "/"my string/"" (with the extra quotes around it).

Why are those there, and how can I get rid of them?

I need them gone because I am setting the title attribute of an element to the string that is returned, and this makes the tooltip have quotes around it (ugly).

like image 833
Bobo Avatar asked Aug 05 '14 15:08

Bobo


1 Answers

parse the string value using JSON.parse(variable)

like image 70
harishr Avatar answered Nov 15 '22 23:11

harishr