Take a look at this example:
app.directive('goto', function($location){
function link(scope, element, attr){
scope.gotoLink = function(){
alert(scope.goto);
//$location.path(scope.goto);
};
}
return {
restrict: 'A',
transclude: true,
scope:{ goto: '@' },
template: '<span ng-click="gotoLink()"><span ng-transclude></span></span>',
link: link
};
});
You can play with it here (plnkr)