new Searcher()
Searcher is a factory that allows a property expression to be used to search
through an objects properties. A property expression is a string that contains a
path using dot notation that leads to a specific property in an object. Some examples include:
'name'
'agency.name'
'a in agencies'
'a.name in products'
It utilizes the angular
$parse service to facilitate some of this functionality.
Example
// Given the following object being searched:
{
name: 'John Doe',
nickname: 'JD',
counts: [1,2,3,4],
products: [{
name: 'Prod',
related: [{
relatedItemName: 'Some related item'
}]
}]
}
var searcher = new Searcher();
search.prop(<expression>).<action>
search.prop('i.name in products').contains(dataToSearch, searchTerm);
Property expression examples:
'i.relatedItemName in products.related' => would search everything in relatedItemName
'i.name in products' => would search everything in the name key in products
'i in counts' => would searching everything in the counts array
'nickname' => would search in nickname