title: Running a function on init in app.component.ts
body: <p>This might be a really stupid question, but I've noticed that the <code>&lt;app-root&gt;</code> in angular does not implement OnInit like all other components. Say I wanted to put a simple <code>console.log('Hello World')</code> in for a example and I wanted that to show every time the app-root was loaded (stupid I know but simple enough for this example), where in the code structure would I do this and does it need a special function name (eg. <code>ngOnInit()</code>)? Or is the whole point of angular for this to be nothing more than just a wrapper that initialises other components.</p>
  
  <p>Here's the code in it basic format as the Angular CLI installs it: </p>
  
  <pre><code>import { Component } from '@angular/core';
  
  @Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.css']
  })
  export class AppComponent {
    title = 'app';
  
  }
  </code></pre>