I am trying to understand a bit further how directives work, so I wrote this simple directive:
Avraam.directive('whoami',function(){
return{
restrict:'A',
template:"<label id='avraam'>Avraam</label>",
link:function(scope, element, attrs) {
var avraam = $(element).find('#avraam');
$(avraam).hide();
}
}
});
People support that the DOM manipulation should be done inside the directive, so I want to ask how can I create an ng-click event handler inside the directive, when the user clicks on the element the elemented will be hidded.