2016-09-02 3 views
1

에 필터링 나는이 같은 JSON 데이터가 있습니다문제가 테이블

[ 
    { 
    "id": 6488, 
    "type": "table", 
    "content": "<table> <tbody> <tr> <td>First</td> </tr> <tr> <td>Second</td> </tr> <tr> <td>Third</td> </tr></tbody> </table>" 
    }, { 
    "id": 123123, 
    "type": "another", 
    "content": "xxxx" 
    } 
] 

나는 content을 표시 ngBindHtml을 사용하고, 그리고 그것은 정말 잘 일하고있어. 문제는 하나뿐입니다. 유형이 table과 같을 때 필터를 만들고 싶습니다.이 방법이 있습니까? 나는 많은 것을 수색했고 나는 이것을위한 해결책을 찾을 수 없었다.

보기는 다음과 같습니다

<input type="text" placeholder="Filter..." ng-model="$ctrl.search"> 
<p></p> 
<strong>Id</strong> 
<p ng-bind="$ctrl.item.id"></p> 
<strong>Type</strong> 
<p ng-bind="$ctrl.item.type"></p> 
<strong>Content</strong> 
<p ng-bind-html="$ctrl.item.content"></p> 

여기 그래서 당신은 더 나은 상황을 이해할 수 demo에 대한 링크입니다.

도움을 주시면 감사하겠습니다.

+0

어디에서 필터를 적용 할 수 있습니까? –

+0

blabla 필터에서 예 :' Joshua

답변

0

필터의 목표는 경우도 다음 검색 당신이 무엇을 할 수 있습니다 :

<div class="form-group"> 
<input class="form-control" name="search" type="text" placeholder="Search" ng-model="search_points"> 
</div> 

및 추가 ->ng-repeat="p in Product.productPoints | filter:search_points" 과 같은 바인딩 {{p.code}} 대신 NG 바인드

참조 용 ->This

+0

이것은 도움이 될지도 모른다 - [이] (http://jsfiddle.net/3gb1n2t9/4) /) –

+0

글쎄, 난 당신이 질문을 이해하지 못했을 것 같아요 .. 나는이 같은 테이블을 필터링하는 방법을 알고 .. 문제는 테이블이 webservice에서 모든 항목과 함께 오는 것입니다. – Joshua