Call a function with button in widget

Is it possible to call a function with a button in a widget like in this w3school tutorial for AngularJS ?

If yes, how?