离子如何读取json数组

时间:2016-03-15 03:38:31

标签: json ionic-framework

我如何读取json array.it像这样加载 enter image description here

我使用此代码加载json arr -

example.controller('ExhibitionTabCtrl', ['$scope', '$http', function($scope,$http) {
      $http.get("json/pills.json")
      .success(function (response) 
      {
       console.log(response);
       $scope.users = response;
      });
    }]);

在列表视图中,红色我的json数据就像这样

<ion-view title="Sig">
 <ion-content class="padding" ng-controller="ExhibitionTabCtrl"> 

<ion-pane>
      <ion-header-bar class="bar-stable">
        <h1 class="title">Ionic Blank Starter</h1>
      </ion-header-bar>
      <ion-content>
       <ion-list>
           <ion-item ng-repeat="x in users|orderBy:'name'">
           {{ x.name + ', ' + x.full_name+', '+x.description}}
           </ion-item>
         </ion-list>
      </ion-content>
    </ion-pane>  



</ion-content>

</ion-view>

但数据没有显示在列表视图中。我可以解决这个问题。任何人都可以帮助我。谢谢。

1 个答案:

答案 0 :(得分:2)

kosala,您需要指定$scope.users = response.Sheet1而不是$scope.users = response