1

I have problem with print data in HTML. I must print data from server.

this is example of link

http://mario.com/jsapp/getdata-new.php?jsonp=2017

it's look:

processData([{"name":"A","open":"0"},{"name":"b","open":"1"}]);

my ctrl

myApp.controller('liveCurrencyCtrl',  function ($scope, $http) {
$http.get("http://mario.com/jsapp/getdata-new.php?jsonp=2017")
    .then(function (response) { 
        $scope.names = response.data; 
        console.log(response.data);
    });}

this is my html

        <div class="liveCurrencyTable" ng-controller="liveCurrencyCtrl">
            <tr ng-repeat="x in names">
                    {{name}}
            </tr>
        </div>

Do you have any idea what I must do? When I print all JSON in HTML I have it in JSON form, but I must print element by element. Tnx for help

mrkibzk
  • 227
  • 4
  • 17
  • when I change a method to $http.jsonp("http://mario.com/jsapp/getdata-new.php?jsonp=2017") , I have error: Uncaught ReferenceError: processData is not defined – mrkibzk Jul 12 '17 at 10:34
  • what does `console.log(response.data);` log?, put that in qstn too. – anoop Jul 12 '17 at 10:35
  • It's resposne json in same forma like on the link, I want print element by element: – mrkibzk Jul 12 '17 at 10:39

1 Answers1

0

It should be x

<tr ng-repeat="x in names">
      {{x.name}}
</tr>
Sajeetharan
  • 216,225
  • 63
  • 350
  • 396