108
rated 0 times
[
109]
[
1]
/ answers: 1 / hits: 5198
/ 10 Years ago, tue, may 13, 2014, 12:00:00
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.
More From » jquery