johnnyfittizio johnnyfittizio - 1 year ago 97
AngularJS Question

AngularJs: How to avoid lettercase while filtering


I had to make my own filter, instead of using the normal angular filter, because of a particular situation:

I have a nested object on four levels: Programs - Days - Halls - Presentations.
Each hall is an accordion containing the relative presentations.

Anyway the filter i made is working properly.

Except one thing: right now the filter is letter case.

So if a presentation name is 'Automation' and the user type 'automation' it won't show up in the results.


Right now is looking for a simple indexOf of the string entered by the user inside the presentation name:

angular.forEach(value_halls.presentations, function(presentation_info, key_presentation)
var name =;
var index = name.indexOf($;

if (index > -1 )



Do you know how can i avoid letter case while filtering?

Thank you!

Answer Source

You can use toLowerCase on both strings:

var index = name.toLowerCase().indexOf($;

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download