0
任何人都可以告訴如何在所有屬性中搜索字符串。如果在某些屬性中匹配,我需要在AngularJS中推送數組中的對象。如何在AngularJS中的對象的所有屬性中搜索字符串
我有一個數組
$scope.ListOfPeople = [
{ PersonID: 10, FirstName: "John", LastName: "Smith", Sex: "Male" },
{ PersonID: 11, FirstName: "James", LastName: "Last", Sex: "Male" },
{ PersonID: 12, FirstName: "Mary", LastName: "Heart", Sex: "Female" },
{ PersonID: 13, FirstName: "Sandra", LastName: "Goldsmith", Sex: "Female" },
{ PersonID: 14, FirstName: "Shaun", LastName: "Sheep", Sex: "Male" },
{ PersonID: 15, FirstName: "Nicola", LastName: "Smith", Sex: "Male" }
];
如果用戶鍵入搜索文本框中的一些值。我需要搜索與PersonID,名字,姓氏,性別與所有屬性,如果匹配需要推送匹配的對象。
的可能的複製[如何搜索使用jQuery JSON樹(http://stackoverflow.com/questions/5288833/how-to-search-json-tree-with-jquery) –
你嘗試過什麼至今 ?網上有很多有關搜索過濾器的文檔 – Alexis
http://stackoverflow.com/a/10679626/5115768你試過這個嗎? – lenny