title: ag-grid API Undefined in Angular 2
body: <p>I am using the ag-grid API in an Angular 2 app, inside the ngOnInit method. </p>
  
  <p>In the onGridReady event <a href="https://stackoverflow.com/questions/40395466/ag-grid-gridoptions-api-undefined-in-angular-2">like mentioned in this post</a>, the API is accessible and things work fine.</p>
  
  <p>However, I need to call the API in one of the following methods as well:</p>
  
  <ul>
  <li>onRowDataChanged</li>
  <li>onNewColumnsLoaded</li>
  <li>onModelUpdated</li>
  </ul>
  
  <p>This is not working because the API is undefined. In addition, for some reason I can also call the API in the onCellDoubleClicked and onCellClicked events.</p>
  
  <p>This seem to be a bug. Does anyone know what is going on?</p>
  
  <p>Please see the code bellow:</p>
  
  <pre><code>ngOnInit() {
  
      this.gridOptions = &lt;GridOptions&gt;{
  
          onGridReady: function (param) {
              param.api.sizeColumnsToFit(); // works fine
          },
  
          onCellDoubleClicked: function (param) {
              param.api.sizeColumnsToFit(); // works fine
          },
  
          onRowDataChanged: function (param) {
              param.api.sizeColumnsToFit(); // API is undefined
          },
      };
  }
  </code></pre>