I don't use template nodes myself, but you could try to create a code snippet similar to this one:
<md-button class="md-raised" ng-click="clicked(); sendMsg(msg)"
function sendMsg(msg) {
if (navigator.geolocation) {
var position = navigator.geolocation.getCurrentPosition();
msg.latitude = position.coords.latitude;
msg.longitude = position.coords.longitude;
$scope.send(msg);
}
else {
alert("Geolocation is not supported by this browser.");
}
}
Caution: I haven't tested this code !!!