title: how to compare values in angular 5
body: <p>this is the html code </p>
  
  <pre><code>   &lt;html&gt;
          &lt;head&gt;
              &lt;title&gt;Halaman Awal&lt;/title&gt;
              &lt;meta charset="UTF-8"&gt;
              &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt;
          &lt;/head&gt;
          &lt;body&gt;
              &lt;nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top"&gt;
                  &lt;a [routerLink]="['/databuku']"&gt;&lt;img src="images/images.png" width="42" height="42"&gt;&lt;/a&gt;
              &lt;/nav&gt;
          &lt;div class="container-fluid text-center pb-5"&gt;
            &lt;div style="text-align:center"&gt;
              &lt;h1&gt;
                Welcome!
              &lt;/h1&gt;
            &lt;/div&gt;
          &lt;/div&gt;
          &lt;form (ngSubmit)="login()"&gt;
              &lt;div class="form-group"&gt;
                  Username
                  &lt;input class="validate" type="text" name="username" [(ngModel)]="dataUser.username" required&gt;
              &lt;/div&gt; 
              &lt;div class ="form-group"&gt;
                  Password
                  &lt;input class="validate" type="text" name="password" [(ngModel)]="dataUser.password" required&gt;
              &lt;/div&gt;
              &lt;div class="form-group"&gt;
                   &lt;button type="submit" class="btn btn-success"&gt;Login&lt;/button&gt;
              &lt;/div&gt;
  
          &lt;/form&gt;
          &lt;/body&gt;
      &lt;/html&gt;
  </code></pre>
  
  <p>this is the ts code</p>
  
  <pre><code>import { Component, OnInit } from '@angular/core';
  import { Router } from '@angular/router';
  import { HttpClient } from '@angular/common/http';
  
  @Component({
    selector: 'app-hlm-utama',
    templateUrl: './hlm-utama.component.html',
    styleUrls: ['./hlm-utama.component.css']
  })
  export class HlmUtamaComponent implements OnInit {
  
    dataUser={};
  
    constructor(private http: HttpClient, private router: Router) { }
  
    ngOnInit() {
    } 
  
    login() {
      this.http.get('http://localhost:8080/user')
      .subscribe(data =&gt; {
          this.dataUser = data;
          this.router.navigate(['/databuku/']);
      }, (err) =&gt; {
        console.log(err);
      });
    }
  
  }
  </code></pre>
  
  <p>so I already have table that have username and password data in database table "dataUser", now I want to compare the data that I input with data in my database table. If its the same, it will execute the login(), if it fails it is not doing anything or at least still in that page, so how to do that? </p>
  
  <p>I don't understand how to do the authentication function or anything, please tell me the simple one</p>