In my code, I have implemented a directive that adds an attribute to HTML elements:
module1.directive('rhVisibleFor', function ($rootScope) {
return{
priority: 10000,
restrict: 'A',
compile: function (el, attr) {
el.removeAttr('rh-visible-for');
el.attr('ng-if', '$layoutPreferences.visibilities[\''+attr.rhVisibleFor+'\']');
// el.attr('ng-if', 'false');
var fn = $compile(el);
return function(scope){
fn(scope);
};
}
}
})
While the compilation of this directive is successful, the generated code does not respond to changes. Even when explicitly setting the ng-if attribute to false, it still gets displayed.