I'm wondering what's the best place to set functions in a directive
//directive
app.directive("clickMe", function() {
return {
restrict: "E",
templateUrl: 'clickMe.html',
controller: function ($scope) {
$scope.clickMe = function(){
}
},
link: function (scope) {
scope.clickMe = function(){
}
}
}
});
//template
<button ng-click="clickMe()">click me</button>
link or controller block ?