AngularJS Example
HTML
<div ng-app="">
<div ng-controller="Ctrl1">
<button ng-click="scope.alertFunc('greet')">Push Med</button>
</div>
</div>
CSS
</style> <!-- Ugly Hack due to jsFiddle issue: http://goo.gl/BUfGZ -->
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular.min.js"></script>
<style>
.ng-invalid { border: 1px solid red; }
JavaScript
function Ctrl1($scope) {
$scope.alertFunc = function(someGlobalFuncReference){
$scope.funcRef = eval(someGlobalFuncReference);
$scope.funcRef('hi there');
greet('boo');
};
}
function greet(msg) { alert(msg); }