Have your attribute restricted directive add a new ng-if attribute whose value is generated based on its own value, then recompile:
.directive('detail', function($compile){
return {
restrict: 'A',
link: function(scope, elem, attrs) {
if(!attrs.ngIf) { // prevent infinite loop
switch (attrs.detail) {
case 'd':
attrs.$set('ngIf', "detail == 'd'");
break;
case 'a':
attrs.$set('ngIf', "detail == 'a'");
break;
case 'da':
attrs.$set('ngIf', "detail == 'd' || detail =='a'");
break;
}
$compile(elem)(scope); // relink directive element
}
}
}
})
Usage:
<div detail="d">My element exists because: <b>$scope.detail == 'd'</b></div>