Parse JSON and show data in Angular

后端 未结 1 577
长发绾君心
长发绾君心 2020-12-17 19:24

I have a trouble with displaying JSON data in Angular. I successfully send data from backend to frontend (Angular), but I cannot display them.

I tried to simulate a

相关标签:
1条回答
  • 2020-12-17 19:52

    As far as I can see, you're storing your Object as JSON, but you never parse it. Therefore using

    $scope.messages = JSON.parse(res);
    

    instead of

    $scope.messages = res;
    

    should fix your problem.

    Here is a working JSFiddle version of yours: https://jsfiddle.net/29y61wtg/5/

    Note, that this doesn't include a $http call, if you're still having problems after using $http, tell me in the comments.

    0 讨论(0)
提交回复
热议问题