title: Angular recursive function for nested objects in array
body: <p>I am building a custom filter pipe for the following structure</p>
  
  <pre><code>[
      {
          "client": {
              "name": "DJASLDJSAKL"
          }, 
          "job_status": {
              "name": "Scheduled"
          }, 
          "descriptor": "Lorem ipsum dolor sit amet consectetur adipiscing elit lacinia quam, ultrices leo interdum senectus integer ultricies venenatis nisl libero, et tellus nec litora volutpat proin duis neque. \r\n\r\nUt metus ac enim mauris malesuada bibendum lectus tincidunt nascetur phasellus, tristique quam libero purus dapibus nisl ultricies urna. \r\n\r\nNisl cubilia donec imperdiet nisi tempus venenatis cras egestas, duis senectus at orci ad porttitor in, magnis suspendisse sem ullamcorper neque tincidunt etiam.\r\n\r\nLitora pulvinar viverra et velit felis massa commodo etiam la.\r\n", 
          "duracion": {
              "text": "00:00:00" 
          }, 
          "tech": {
              "eta_promise_date": "Nov 20 2019 03:05:00:PM"
          }, 
          "siteAddress": "537 West Thomas Drive Rolling Meadows, IL 60008"
      }
  ]
  </code></pre>
  
  <p>I first made a function that works only at first level, or top level. Searching I have like an idea, but at the same time I'm kind of lost, this is the method in which I'm working</p>
  
  <pre><code>  findObject(obj, searchTerm){
     Object.keys(obj).forEach((key) =&gt; {
       //let r = RegExp(searchTerm, 'gi').test(obj[key]);
       if(obj === searchTerm){
         console.log(`key: ${key}, value: ${obj[key]}`);
         if(typeof obj[key] === 'object'){
           this.findObject(obj[key], searchTerm);
         }
         return null;
       }return null;
  
     });
    }
  </code></pre>
  
  <p>But I'm getting an infinite loop at the moment </p>
  
  <p><strong>EDIT</strong> Adding the view section</p>
  
  <pre><code>    &lt;ion-list *ngFor="let order of workOrders | filtro: searchTerm"&gt;
        &lt;ion-item *ngFor = "let location of order.site" (click)="showOrderLocation(order)"&gt;
          &lt;ion-icon name="pin" item-start [ngStyle]="{'color':order.job_status.color}"&gt;&lt;/ion-icon&gt;
           &lt;h4&gt;{{order.code}}&lt;/h4&gt;&lt;br&gt;
           &lt;p&gt;{{order.job_status.name}}&lt;/p&gt;&lt;br&gt;
           &lt;small&gt;ETA: {{order.etaPromise}}&lt;/small&gt;&lt;br&gt;
           &lt;small&gt;Deadline: {{this.relativeDate(this.utcToLocalTime(order.tech.eta_promise_date))}}&lt;/small&gt;&lt;br&gt;
           &lt;p&gt;{{order.descriptor}}&lt;/p&gt;
        &lt;/ion-item&gt;
      &lt;/ion-list&gt;
  </code></pre>