过滤AngularJS Json文件

时间:2016-03-12 16:12:10

标签: angularjs json ionic-framework

我试图像这样过滤我的ng-repeat List:

我的JSON喜欢这样:http://ddragon.leagueoflegends.com/cdn/6.5.1/data/en_US/champion.json

这是JS Fiddle

angular.module('app', ['ionic'])

.controller("ListCtrl", function ($scope, $http) {

  $http.get("http://ddragon.leagueoflegends.com/cdn/6.5.1/data/en_US/champion.json").then(function (data) {
    $scope.data = data.data.data;
  });
});
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
    <link href="https://code.ionicframework.com/1.0.0/css/ionic.min.css" rel="stylesheet">
    <script src="https://code.ionicframework.com/1.0.0/js/ionic.bundle.js"></script>
  </head>
  <body ng-app="app">
    <ion-pane>
      <ion-header-bar class="bar-stable">
        <h1 class="title">Awesome App</h1>
      </ion-header-bar>

      <ion-content class="padding" ng-controller="ListCtrl">
        <input type="text" ng-model="search" placeholder="suche">
        <ion-list>
          <ion-item ng-repeat="champ in data">
            <h1>{{champ.name}}</h1>
          </ion-item>
        </ion-list>
      </ion-content>
    </ion-pane>
  </body>
</html>

我希望有人可以帮助我!

非常感谢。

0 个答案:

没有答案