Reputation:
I have the following code:
Titre: <input ng-model="rechercheTitre">
Organisateur: <input ng-model="rechercheOrganisateur">
....
<li ng-repeat="resultats in resultatsJSON.results | filter:rechercheTitre">
<span ng-bind-html="resultats.tra_title | highlight:rechercheTitre"></span>
Organisateur(s) : {{resultOrganisateurs}}
</li>
My results is correctly display but the filter in ng-repeat is applied on rechercheTitre and rechercheOrganisateur. I only want the filter applied to rechercheTitre. How can i do that ?
Upvotes: 2
Views: 161
Reputation:
Find the solution.
Correct answer is:
filter:{tra_type:rechercheType.tra_type}
Upvotes: 0
Reputation:
I have try:
filter:{rechercheTitre:rechercheTitre}
no error in the console but when i put a letter on my rechercheTitre input, all the results are hiden. I have also test:
filter:{rechercheTitre:resultats.tra_title}
no error in the console but in that case all the results are always displayed.
In case it help, here is how my json file is make:
{
"count": 90,
"results": [
{
"tra_speakers": "Jack"
"tra_title": "test titre",
}, ....
Upvotes: 0
Reputation: 193261
In this case you should use object notation:
ng-repeat="resultats in resultatsJSON.results | filter:{rechercheTitre: rechercheTitre}"
where you define by what properties (in this case rechercheTitre
) array elements must be filtered.
Upvotes: 1