Allow closing dialog via template click handler

It would be good, if we could close current dialog in template handler, for instance like this 
```html
<div class="dialog-contents">
	<input type="text"/>
	<input type="button" value="OK" ng-click="checkInput() && closeThisDialog()"/>
</button>
```

This pull request does this.