I've been at this for awhile now with no luck so I thought I'd throw something up on SO.
I need the function of a click event in and Angular directive to execute only if the source comes from the tbody
not the thead
. I've tried a number of routes to get this information, but I can't seem to get the syntax right.
Any help/guidance would be greatly appreciated. Here is my latest/best attempt. Will give you and idea what I'm going for:
/* Linker for the directive */
var linker = function (scope, elm, attrs) {
window.setTimeout(function(){
elm.find('table tbody tr.uib-weeks td button span.text-info').closest('tr').find('button').addClass('chosenReportWeek');
}, 1000); // This is a hack until we can find the proper load/render event
elm.on('click', function(event) {
if(event.target.parent.indexOf('thead') === -1){
elm.find('table tbody tr.uib-weeks button.active').closest('tr').find('button').addClass('chosenReportWeek');
}
});
};