title: Angular ngStyle show/hide condition not working
body: <p>I am trying to show hide my navbar on click of an image. On first click it is working, after that it doesn't. Not sure what is wrong. Any help please???</p>
  
  <p><a href="https://stackblitz.com/edit/responsive-menu-angular-material-flex-layout-cm87il" rel="nofollow noreferrer">https://stackblitz.com/edit/responsive-menu-angular-material-flex-layout-cm87il</a></p>
  
  <pre><code>&lt;img id="project-avatar" (click)="toggleNavbar()" width=20, height=20 style="position: relative;" alt="Show Hide Navigation Menu" src="/assets/img/slider_hide.png" /&gt;
  &lt;div&gt; 
  
  &lt;div class="showHideNavbar" [ngStyle]="displayNavbar == '1' ? {'visibility': 'visible'} : {'visibility': 'hidden'}"&gt;
    &lt;mat-toolbar color="primary" &gt;
  </code></pre>
  
  <h2>component.ts</h2>
  
  <pre><code>displayNavbar: string;
  
  ngOnInit() {
      this.displayNavbar = '1';
  }
  
  toggleNavbar() {
  
      if(this.displayNavbar == '0') {
          this.displayNavbar = '1';
          alert(this.displayNavbar);
      } if(this.displayNavbar == '1') {
      //    alert("1 - Changing to 0");
          this.displayNavbar = '0';
      } else {
          this.displayNavbar = '1';
      }
  }
  </code></pre>
  
  <p>1) Onload of the page the toolbar should show - it is showing as expected
  <a href="https://i.stack.imgur.com/RqjGS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RqjGS.png" alt="enter image description here"></a></p>
  
  <p>2) On click of the icon(at top left corner), the toolbar should hide - it is working first time
  <a href="https://i.stack.imgur.com/RsamL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RsamL.png" alt="enter image description here"></a></p>
  
  <p>3) On click of the icon again, the toolbar should display again - it is NOT working</p>
  
  <p><a href="https://stackblitz.com/edit/responsive-menu-angular-material-flex-layout-cm87il" rel="nofollow noreferrer">https://stackblitz.com/edit/responsive-menu-angular-material-flex-layout-cm87il</a></p>