How to use TypeScript on a button click
I need to call a function on certain event.
If the function is global e.g. TypeScript:
function foo(){
alert('foo');
}
Just use onclick
e.g. html:
<button onclick="foo()">click me!</button>
Remember TypeScript is (almost) JavaScript.
However I recommend using a framework like angular with TypeScript. For maintainability. As an example take a look at the browser quickstart.