2016-09-13 38 views
0

hi配列内のオブジェクトのリストをフィルタリングして表示しようとしています。フィルタリングは、入力フィールドからのユーザー入力に基づいています。フィルタ付きng-filterがフィルタリングされていません

私はStackoverflowの質問の数を見てきましたが、私のデータは既に配列に入っているので、これは異なっていると思います。 HTML:

<body ng-app="MyApp"> 
    <div ng-controller="MyCtrl"> 
    <form class="form-inline"> 
     <input ng-model="search" type="text" 
     placeholder="Filter by" autofocus> 
    </form> 
    <div ng-repeat="f in feedbacklist | filter:search "> 
     <div>{{f.jobId}}</div> 
    </div> 
    </div> 
</body> 

JS:

var app = angular.module("MyApp", []); 

app.controller("MyCtrl", function($scope) { 
$scope.search = ""; 
$scope.feedbacklist = [ 
       { 
        jobId: "1432", 
        feedbackId: "342342", 
        profileUrl: "assets/img/profiles/avatar_small2x.jpg", 
        address: "24 Mathers St, Smithswood", 
        name: "Jorem Ipsum", 
        initials: "JP", 
        content: "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.", 
        date: "23/05/2016", 
        message: "", 
        replies: [ 
         { 
          jobId: "1232", 
          feedbackId: "342342", 
          profileUrl: "assets/img/profiles/avatar_small2x.jpg", 
          address: "24 Mathers St, Smithswood", 
          name: "Jorem Ipsum", 
          initials: "JP", 
          content: "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.", 
          date: "23/05/2016", 
         }, 
         { 
          jobId: "1232", 
          feedbackId: "342342", 
          profileUrl: "assets/img/profiles/avatar_small2x.jpg", 
          address: "24 Mathers St, Smithswood", 
          name: "Jorem Ipsum", 
          initials: "JP", 
          content: "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.", 
          date: "23/05/2016", 
         } 
        ], 

       }, 
       { 
        jobId: "1232", 
        feedbackId: "342342", 
        profileUrl: "", 
        address: "24 Mathers St, Smithswood", 
        name: "Jorem Ipsum", 
        initials: "JP", 
        content: "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.", 
        date: "23/05/2016", 
        message: "", 
        replies: [ 

        ], 

       }, 

      ]; 



}); 

私はあなたのコードですべての問題を見つけることができませんフィドルhere

+2

このコードを使用し、あなたの質問は何ですか? – Phil

+0

また、あなたのJSFiddleにいくつかの問題がありました。ここで固定〜http://jsfiddle.net/z2stbsqt/5/ – Phil

+0

何らかの理由で自分のコードで動作していない...データ構造はここのものとまったく同じです。あなたはフィドルで何を修正しましたか?そしてありがとう。 – user1012500

答えて

0

このコードを作成しました。私が知りたいのは、オブジェクト内のどのプロパティをフィルタリングするかだけです。

あなたは 'のJobId' によってそれをフィルタリングしたい場合は、 filter:{jobId:search}

Fiddle Link

関連する問題