So I'm having a little trouble with altering JSON objects in a MySQL database via the RESTapi, when I change a value it will update the bound scope object, but it will change it into a JSON string, then if I refresh the page it will actually parse the JSON correctly.
example:
table:
animal
id:int(ai) | name:string | interests:json
1 | Mr. Sniffles | ["mewing","taking over the world","catnip"]
So the in my controller this will get me a object:
$scope.animals
[{
id: 1,
name: "Mr. Sniffles",
interests: [
"mewing",
"taking over the world",
"catnip"
]
}]
Which is great, but now if I HTTP PUT to /animal/1
interests : '["mewing","catnip"]'
Hey,
So I'm having a little trouble with altering JSON objects in a MySQL database via the RESTapi, when I change a value it will update the bound scope object, but it will change it into a JSON string, then if I refresh the page it will actually parse the JSON correctly.
example:
table: animal
id:int(ai) | name:string | interests:json
1 | Mr. Sniffles | ["mewing","taking over the world","catnip"]
So the in my controller this will get me a object: $scope.animals
[{ id: 1, name: "Mr. Sniffles", interests: [ "mewing", "taking over the world", "catnip" ] }]
Which is great, but now if I HTTP PUT to /animal/1 interests : '["mewing","catnip"]'
It will change the scope object into:
[{ id: 1, name: "Mr. Sniffles", interests: '["mewing","catnip"]' // (string) }]
Then if I refresh the page it will change it into:
[{ id: 1, name: "Mr. Sniffles", interests: [ "mewing", "catnip" ] }]
Thanks in advance,