title: Angular2 - OnInit is not defined
body: <p>I'm trying to implement the angular 2 onInit function but I get the following error in the console:</p>
  
  <blockquote>
    <p>Error: ReferenceError: OnInit is not defined(...)</p>
  </blockquote>
  
  <p>Can somebody point out what I'm doing wrong?</p>
  
  <p>This is my component:</p>
  
  <pre><code>import { Component, OnInit } from 'angular2/core';
  import { ViewEncapsulation } from 'angular2/core';
  
  @Component({
      selector: 'Landing',
      templateUrl: '/app/views/landing.html',
      styleUrls: ['../app/styles/landing.css'],
      encapsulation: ViewEncapsulation.None
  })
  
  export class LandingComponent implements OnInit {
  
      function checkOverflow() {
          var element = document.querySelector('.appContainer');
          if( (element.offsetHeight &lt; element.scrollHeight) || (element.offsetWidth &lt; element.scrollWidth)){
             // your element have overflow
            console.log('OVERFLOW!');
          }
          else{
            console.log('NO OVERFLOW');
          }
      }
  
      OnInit() {
          checkOverflow();
      }
  
  }
  </code></pre>