javascript - angularjs doesn't return string value, but other types -
i'm using typescript , angularjs data server, when try display data on page, string type doesn't show while rest shows expected. data parsed json can see data want. i'm not sure if it's angularjs or typescript although think it's typescript. might have missed something.
it name
property doesn't display while count
shows expected
var promise = $http.get("/data/book").success( function (data) { var response = data; $scope.book= []; (var = 0; < response.length; i++) { var name = response[i].name; var count = response[i].count; $scope.book.push(new book(name, count)); }
you want deserialize message, you'll have json string, not javascript object:
var response = json.parse(data);
if sure angular has done per comment @aapierce, should check structure of object. example, following line suspect:
var response = data; (var = 0; < response.length; i++) {
for example, array parent of response? perhaps after (for example) response.books.length
rather response.length
. obviously, entirely depends on json, if post answer can far more definitive.
Comments
Post a Comment