If it is not an array we can check easily like below example.
var _name = "prasho";
var _list = [{name:'prasho'},{name:'Gorge'}];
for(var i=0;i<_list.length;i++)
{
if(_name.toLoweCase().indexOf(_list[i].name.toLoweCase()) != -1){
//do what ever
}else{
//do what ever
}
}
But if _name is an array then how we can make it lower case and check the indexOf
var _name = ['prasho','abraham','sam','anna']
var _list = [{name:'prasho'},{name:'Gorge'}];
for(var i=0;i<_list.length;i++)
{
if(_name.map(function (c) {
return c.toLowerCase();
}).indexOf(_list[i].name.toLowerCase()) != -1) {
//do what ever
}else{
//do what ever
}
}
Related Posts
1. Angular js client side pagination like google.
2. Angular Loader using font awesome icons
3. Angular js add class to active element
It helped me thanks.
ReplyDelete