【发布时间】:2017-12-16 17:32:05
【问题描述】:
HTML 中的打印数据有问题。我必须从服务器打印数据。
这是链接示例
http://mario.com/jsapp/getdata-new.php?jsonp=2017
看起来:
processData([{"name":"A","open":"0"},{"name":"b","open":"1"}]);
我的 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);
});}
这是我的html
<div class="liveCurrencyTable" ng-controller="liveCurrencyCtrl">
<tr ng-repeat="x in names">
{{name}}
</tr>
</div>
你知道我必须做什么吗?当我以 HTML 格式打印所有 JSON 时,我以 JSON 格式显示它,但我必须逐个元素地打印。 Tnx 寻求帮助
【问题讨论】:
-
当我将方法更改为 $http.jsonp("mario.com/jsapp/getdata-new.php?jsonp=2017") 时,出现错误:Uncaught ReferenceError: processData is not defined
-
console.log(response.data);记录了什么?,也将其放入 qstn。 -
它的响应格式与链接上的相同,我想逐个打印元素: