title: Dynamic (click) function - Angular2
body: <p>I am having a little trouble with binding a dynamic function to a click event. Please see below:-</p>
  
  <p>File 1</p>
  
  <pre><code>&lt;title-bar [actions]='[{title: "Create A New Plan", link: "hello"}]' &gt;&lt;/title-bar&gt;
  </code></pre>
  
  <p>File 2</p>
  
  <pre><code>&lt;div class="actions" *ngIf="actions"&gt;
      &lt;a *ngFor="let action of actions" class="ui primary button" (click)="[action.link]()"&gt;{{action.title}}&lt;/a&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>All of the code is working perfectly apart from when I am binding the action.link in the (click).</p>
  
  <p>If I create the following button:-</p>
  
  <pre><code>&lt;button (click)="hello()"&gt;&lt;/button&gt;
  </code></pre>
  
  <p>It calls the hello() function as it should. but for some reason I am not able to get this to work dynamically.</p>
  
  <p>Does anybody have a simple solution to this I may have over looked?</p>
  
  <p>The function is calling a simple alert just for testing:-</p>
  
  <pre><code>public hello() {
      alert('test');
  }
  </code></pre>
  
  <p>II have attempted to change the click event to the following but with no joy:-</p>
  
  <pre><code>(click)="action.link"
  (click)="[action.link]()"
  (click)="this[action.link]()"
  </code></pre>
  
  <p>I get the following errors respectively:-</p>
  
  <pre><code>No error, but not function called
  inline template:3:2 caused by: ["hello"] is not a function
  inline template:3:2 caused by: self.parentView.parentView.context[self.context.$implicit.link] is not a function
  </code></pre>
  
  <p>Any help with a push in the right direction will be very much appreciated.</p>