title: Declare variable in Angular component. In ngOnInit or in variable declaration?
body: <p>On an Angular 7 application I have the following component:</p>
  
  <pre class="lang-ts prettyprint-override"><code>export class ListComponent implements OnInit {
  
    visible: boolean;
  
    ngOnInit() {
      this.visible = false;
    }
  
    toggle() {
      this.visible = !this.visible
    }
  
  }
  </code></pre>
  
  <p>And on the view I have:</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;table *ngIf="visible"&gt;
    Table content
  &lt;/table&gt;
  </code></pre>
  
  <p>Is there any difference between setting the initial value of visible inside ngOnInit or in variable declaration, e.g:</p>
  
  <pre class="lang-ts prettyprint-override"><code>visible: boolean = false;
  </code></pre>
  
  <p>Which approach is better?</p>