title: AngularJS / Firebase Cannot read property 'toLowerCase' of undefined
body: <p>I am trying to convert an app that used a PHP API to load data into an AngularJS app to one that uses Firebase for the backend. </p>
  
  <p>I think I almost got it but it is throwing an error of </p>
  
  <p>TypeError: Cannot read property 'toLowerCase' of undefined</p>
  
  <p>This is where i am using 'toLowerCase'</p>
  
  <pre><code>app.filter('searchFor', function(){
  
      return function(arr, searchString){
          if(!searchString){
              return arr;
          }
          var result = [];
          searchString = searchString.toLowerCase();
          angular.forEach(arr, function(i){
              if(i.english.toLowerCase().indexOf(searchString) !== -1){
                  result.push(i);
              }
              if(i.spain.toLowerCase().indexOf(searchString) !== -1){
                  result.push(i);
              }
              if(i.germany.toLowerCase().indexOf(searchString) !== -1){
                  result.push(i);
              }
              if(i.france.toLowerCase().indexOf(searchString) !== -1){
                  result.push(i);
              }
              if(i.philippines.toLowerCase().indexOf(searchString) !== -1){
                  result.push(i);
              }
              });
          return result;
      };
  
  });
  </code></pre>
  
  <p>Any idea what might be going wrong?</p>