使用Onsen UI框架的网格中的JSON数据

使用Onsen UI框架的网格中的JSON数据,json,angularjs,onsen-ui,Json,Angularjs,Onsen Ui,我试图获取JSON数据并将其填充到网格中,但发现OnsenUI使用了ons col和ons row,网格中没有标记。因此,我使用了一个教程示例,并按照下面给出的方式进行了编辑,我认为它会起作用,但作为一名新手,我错了 片段1 <ons-row style="margin-top: 100px;" ng-controller="myController" ng-repeat="x in names"> <ons-col align="center"> {{x.Name}}

我试图获取JSON数据并将其填充到网格中,但发现OnsenUI使用了ons col和ons row,网格中没有标记。因此,我使用了一个教程示例,并按照下面给出的方式进行了编辑,我认为它会起作用,但作为一名新手,我错了

片段1

<ons-row style="margin-top: 100px;" ng-controller="myController" ng-repeat="x in names">
<ons-col align="center">
{{x.Name}}
</ons-col>
<ons-col align="center">
{{x.Country}}
</ons-col>
</ons-row>
片段2

<script>
 module.controller('myController', myController);
 function myController($scope,$http) {
      $http.get("http://www.w3schools.com//website/Customers_JSON.php")
      .success(function(response) {$scope.names = response;});
 }
</script>

我真正需要的是在一列中显示姓名,在另一列中显示国家。任何帮助都将不胜感激。谢谢。

您在注册控制器后定义了函数,因此您将向控制器传递一个未定义的值


您的代码运行良好。我试着运行它,它在两列中显示姓名和国家。我得到一个空白屏幕。您的ajax调用是否实际返回任何响应?是的,当在列表中使用它时,它会显示名称和国家,{{x.name+','+x.country}}您又这样做了@Andreas Argelius,谢谢。它起作用了。一个简单的错误。
module.controller('myController', function($scope,$http) {
      $http.get("http://www.w3schools.com//website/Customers_JSON.php")
      .success(function(response) {$scope.names = response;});
});