I want to filter a JSON based only certain members of the JSON object. Here is the fiddler and here is the html code.
<body ng-app="faq" ng-controller="faqDisplay">
<input ng-model="searchText"></input>
<div ng-repeat="question in questions|filter:searchText">
<li>{{question.question}}</li>
</div>
</body>
Here is the script for that
var faq = angular.module('faq', []);
faq.controller('faqDisplay', function ($scope) {
$scope.questions = [{
question: "Abc",
answer: "efg",
count: "197",
qname: "q1"
}, {
question: "FGH",
answer: "dfs",
count: "61",
qname: "q2"
}, {
question: "IJK",
answer: "dsds",
count: "3241",
qname: "q3"
}];
});
In my fiddle, if you enter in the values I have assigned for count or qname in the input field it will display the questions accordingly but I want it to filter only based on the data members: question and answer (Show the questions only if the searchText contains words/characters which are either in question or answer only).
Can anyone help me with this.