title: Value comparison in <div> using *ngFor
body: <p>I am trying to compare values coming from database to the value I am entering on my angular 2 model driven form. I want to display a div when the values are not equal. I am trying the logic below but I am unable to make it work. Help will be appreciated.</p>
  
  <p><strong>View</strong></p>
  
  <pre><code>&lt;form [formGroup]="reguserform" #f="ngForm" (ngSubmit)="register()"&gt;
  &lt;fieldset&gt;
      &lt;div class="form-group"&gt;
          &lt;label for="Username"&gt;Username&lt;/label&gt;
          &lt;input class="form-control"
                 [(ngModel)]="user.Username"
                 type="text" id="Username"
                 formControlName="Username" /&gt;
      &lt;/div&gt;
      &lt;div class="alert alert-danger"
           *ngIf="reguserform.controls.Username.touched &amp;&amp; reguserform.controls.Username.errors"&gt;
          &lt;div *ngIf="reguserform.controls.Username.errors.required"
               class="alert alert-danger"&gt;
              Please enter a valid Username...
          &lt;/div&gt;
          &lt;div *ngFor="let r of rusers"&gt;
              &lt;div *ngIf="r.Username == user.Username" class="alert alert-danger"&gt;Username is taken&lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/fieldset&gt;
  </code></pre>
  
  <p></p>
  
  <p><strong>Component</strong></p>
  
  <pre><code>getUsers() {
      this.authenticationService.getRegUser().subscribe(
          res =&gt; this.rusers = res
      );
  }
  </code></pre>
  
  <p>Everything is fine from the db end the object is being logged in console too but at the time of comparison no div is shown.</p>