Sunday, January 28, 2018

Angular, html template hack

Hack: 
To place a void returning function call into a html template one can put it into an || block with another function as it will evaluate to false and cause the other function to execute as if it stood alone.

Solution: 

Use an attribute selector.

{{console.log('text') || doSth()}}