I have query about Angular 1x. I want to filter the below records if anything matches with title and content only. I tried giving ng-model
to my input and applied the same like ng-repeat= t in t.items | filter:keyword
but it is filtering the data with link and all other columns as well.
var myApp = angular.module('myApp',[]);
myApp.controller('SearchController', ['$scope', function($scope) {
$scope.results = [
{ title : "Cars", link: "http://tutorialedge.net", content: "lorem ipsum doler fox pixel"},
{ title : "Boats", link: "http://tutorialedge.net", content: "lorem ipsum doler cat pixel"},
{ title : "Vans", link: "http://tutorialedge.net", content: "lorem ipsum doler pig pixel"},
{ title : "Limos", link: "http://tutorialedge.net", content: "lorem ipsum doler pixel"}
];
}]);
Is it possible to filter data from 2 just columns?
Edit
I have a <input type="search" />
and I want to filter data as soon as user starts typing but it should search the keywords in just two columns.
Have a look at https://docs.angularjs.org/api/ng/filter/filter it explains everything pretty good. For your question you can do it like:
Component's controller:
Then in component's template: