title: Angular 4 component lifecycle
body: <p>I am trying to use the component life cycle hooks that are exposed by Angular 4 to process certain information related to the component.<br>
  When I tried to search I was able to find the list of life cycle hooks that are exposed by angular 4 (<a href="https://angular.io/guide/lifecycle-hooks" rel="noreferrer">https://angular.io/guide/lifecycle-hooks</a>) <br>
  I am more interested in the code snippet that triggers few of these methods.
  For example in Java following lines of code would trigger the constructor in 'String' class:</p>
  
  <pre><code>String hotelName = new String("Marriott");
  </code></pre>
  
  <p>What would be the HTML, JavaScript code that would trigger following life cycle methods:</p>
  
  <ul>
  <li>constructor</li>
  <li>ngOnInit</li>
  <li>ngAfterViewInit</li>
  <li>ngAfterViewChecked</li>
  <li>ngOnDestroy</li>
  </ul>
  
  <p>Thanks in advance.</p>