title: Angular2 write on console from template click event
body: <p>I wonder whether the following is possible somehow. The question is not limited to <code>console.info</code> but all Javascript functions in general.</p>
  
  <pre><code>&lt;a (click)="console.info(foo)"&gt;click me doesn't work&lt;/a&gt;
  </code></pre>
  
  <p><code>Cannot read property 'info' of undefined</code></p>
  
  <p>It seems that templates can only access component properties, so you have to create an extra function for that inside your <code>Component</code>:</p>
  
  <pre><code>&lt;a (click)="executeConsole(val)"&gt;execute console does work&lt;/a&gt;
  
  executeConsole(val) {
    console.info(val);
  }
  </code></pre>
  
  <p>With React you can do something like that:</p>
  
  <pre><code>&lt;a onClick={() =&gt; console.info('it works')}&gt;it works&lt;/a&gt;
  </code></pre>