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