I have an custom directive
<div class="btn active" approveme="" data-ismember="0">
<i class="show-mobile fa fa-mail-reply" title="Aprove"></i>
<i class="hide-mobile">Approve</i>
</div>
I am binding a click to this div on click the html inside the div changes to Deny.
Here is the sample code of my directive.
app.directive('approveme', function($modal) {
return function(scope, element, attrs, modal) {
var somefunction = function(){
if(attrs.ismember == 0){
//do something
}
};
element.bind('click', somefunction);
}
});
When I click the edge of the button the and console.log element I get the parent div which returns the ismember attribute.
However when I click the text inside the div, element returns the <i> tag which does not have the attribute ismember
How do get element to always return the parent div?
<button>element. It would be more semantically suited or this purpose.