title: Alert message in angular 2
body: <p>I am not able to display the alert message when the login credentials are wrong. It doesn't display in the else scope but when i enter the message in the if scope, it displays? Can someone help me? </p>
  
  <pre><code> message:string;
  
      //login user credentials to authenticate
      submitForm() {
  
  
          this.service.login(this.login.username, this.login.password)
              .subscribe(data =&gt; {
                  if(data == true){
  
  
                  }else {
                      this.message = "Username or Password Invalid";
  
                  }
              });
  
  
  }
  </code></pre>
  
  <p>//html</p>
  
  <pre><code>  &lt;div *ngIf="message" class="alert alert-danger text-center " style="width: 40%; font-size: 16px" &gt;{{message}}&lt;/div&gt;
  </code></pre>