RafaelVidaurre / angular-permission

Simple route authorization via roles/permissions
MIT License
1.13k stars 212 forks source link

Configuration of default directive behaviour #387

Closed davefmoore closed 7 years ago

davefmoore commented 7 years ago

Provide an option to use ng-if vs show/hide, or make ng-if the standard. I believe there are many benefits to this if you are using a component based architecture. From preventing viewing the html in the DOM to preventing http calls/ extra watchers. ie. dashoard with user components and admin components...

krasavchegUa commented 7 years ago

+1

byms commented 7 years ago

+2

masterspambot commented 7 years ago

It is described in documentation how to alter directive behavior. One possibility is to extend implementation to choose at app configuration stage the option between ng-hide, ng-if or custom one.

On Mon, 27 Feb 2017, 13:15 Denis, notifications@github.com wrote:

+2

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Narzerus/angular-permission/issues/387#issuecomment-282766823, or mute the thread https://github.com/notifications/unsubscribe-auth/AAjeASXlqoijxxYpQxUloDoQyOwj7iE8ks5rgvaegaJpZM4MFhr7 .

krasavchegUa commented 7 years ago

Hello ;) Its not cool to add permission-on-authorized, permission-on-unauthorized on every element. I think $element.remove() should be out the box instead of $element.addClass('ng-hide').

krasavchegUa commented 7 years ago

It seems that "permission-on-unauthorized" attribute doesnt work with "ng-include" directive. Got error TypeError: permission.onUnauthorized(...) is not a function at onUnauthorizedAccess.

"angular" : 1.6.2, "angular-permission" : 3.2.1

masterspambot commented 7 years ago

@krasavchegUa It is because ng-include has higher priority of execution. Use permission directive on the wrapping element of ng-include. Additionally this is not related directly to the subject of the issue.

krasavchegUa commented 7 years ago

Awesome!!!

Eduardo-Julio commented 7 years ago

So, has someone edited the behavior so it works like ng-if or with ng-if?