title: ngFor loop continue executing and crash the app in ionic 3 with firebase database
body: <p>I'm developing <code>Hybrid</code> chatting app using <code>ionic 3 framework</code> with <code>Firebase</code> backend. I'm filtering some types of data which i get from firebase. it's working but for loop is continuously executing and after some time my app crash.
  I exactly want to check mobile number of user(Which i get from database) and my contact list(User's phone-book). Here i have also added some JavaScript functions for remove space between number and get last 10 digits of number. Please suggest me if you know any better way to do it.
  Please find my code below. Thank you.</p>
  
  <blockquote>
    <p>Html</p>
  </blockquote>
  
  <pre><code>&lt;div *ngFor="let key of filteredusers; let i = index"&gt;
    &lt;ion-item *ngIf="arraysEqual2(key)"&gt;
      &lt;ion-avatar item-start&gt;
        &lt;img src="{{key.photoURL}}"&gt;
      &lt;/ion-avatar&gt;
      &lt;h2&gt;{{key.displayName}}&lt;/h2&gt;
      &lt;p *ngIf="key.phoneNumbers"&gt;{{key.mobile}}&lt;/p&gt;
      &lt;button ion-button outline item-end (click)="sendreq(key,i)"&gt;Add&lt;/button&gt;
    &lt;/ion-item&gt;
  &lt;/div&gt;
  </code></pre>
  
  <blockquote>
    <p>Ts</p>
  </blockquote>
  
  <pre><code>  arraysEqual2(data) {
      var number
      if (data.mobile) {
        number = data.mobile
      } else {
        number = ''
      }
      var contact: any
      for (contact of this.contactlist) {
        if (contact.phoneNumbers &amp;&amp; this.setnumber(contact.phoneNumbers[0].value) == number) {
          return true
        }
      }
    }
  
    setnumber(str) {
      var filter1 = str.replace(/\s/g, '')
      var final = filter1.substr(str.length - 10)
      console.log(final)
      return final
    }
  </code></pre>