Angular JS - Exposing Controller Function outside the module via onClick function call

Exposing Controller Function outside the module via onClick function call For re-using already defined onClick functions

HTML

<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css">
<div ng-app="myapp">
         <div ng-controller="Controller">
          <div message>click here</div>
        </div>
        </div>

JavaScript

angular.module('myapp', [])
         .controller('Controller', ['$scope', function($scope) {
            $scope.showmessage = function(){
            alert("hello framgia");
            };
         }])
         .directive('message', function() {
             return function(scope, element, str) {
             element.bind('mouseenter', function(){
               scope.showmessage();
             });
             };
         });