title: Angular2 Undefined Object attribute when using a callback function as Component @Input()
body: <p>Im trying to bind a callback function to a directive, when the event is fired the attribute of the parent component are undefined</p>
  <p>app.ts</p>
  <pre><code>import {Component} from 'angular2/core';
  import {bootstrap} from 'angular2/platform/browser';
  import {MyComponent} from './my-component';
  
  @Component({
    selector: 'my-app',
    template: `
    &lt;button (click)=&quot;appOnClick('CLICK FROM APP')&quot;&gt;BUTTOM OUTSIDE COMPONENT&lt;/button&gt;
    &lt;br&gt;&lt;br&gt;
    &lt;my-component [onClick]=&quot;appOnClick&quot;&gt;&lt;/my-component&gt;`,
    directives: [MyComponent]
  })
  export class MyApp { 
    
    public theBoundCallback: Function;
    test:string = &quot;THIS SHOULD HAVE A VALUE&quot;;
    
    public ngOnInit(){
      this.theBoundCallback = this.appOnClick.bind(this);
    }
    
    appOnClick(someText){
      
      console.log(someText);
      console.log(this.test);
      
    }
  }
  
  bootstrap(MyApp);
  </code></pre>
  <p>my-component.ts</p>
  <pre><code>import {Component, Input} from 'angular2/core';
  
  @Component({
    selector: 'my-component',
    template: `&lt;button (click)=&quot;onClick('CLICK FROM COMPONENT')&quot;&gt;BUTTOM INSIDE COMPONENT&lt;/button&gt;`
  })
  export class MyComponent{
  
    @Input() onClick: Function;
    
  }
  </code></pre>
  <p>That will render two buttons:<br></p>
  <p>
  BUTTOM OUTSIDE COMPONENT, this calls the appOnClick function direct from the app, when clicked the console shows:<br>
  - CLICK FROM APP<br>
  - THIS SHOULD HAVE A VALUE
  </p>
  <p>
  BUTTOM INSIDE COMPONENT, this calls the appOnClick function via the @Input function in the component, when clicked the console shows:<br>
  - CLICK FROM APP<br>
  - undefined
  </p>
  <p>I've created the example on <a href="http://plnkr.co/edit/UhbcxyJXn3w8SqtU9ysa?p=preview" rel="nofollow noreferrer">Plunker</a></p>
  <p>Is that a way to assign this correctly so I can work with my object attributes when the callback is trigger?</p>