question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ngx-permissions & material design issue

See original GitHub issue

Hi Alex,

I’m using Angular 7 and ngx-permissions v 6.0.6 and it looks like the strategies are not working if the material design is used. A brief example:

<button mat-raised-button color="primary"  (click)='test()' 
*ngxPermissionsOnly="['ADMIN']; unauthorisedStrategy: 'ngxDisableElement'">
	ADMIN-enabled (1)
</button>

<button  (click)='test()' *ngxPermissionsOnly="['ADMIN']; unauthorisedStrategy: 'ngxDisableElement'">
	ADMIN-enabled (2)
</button>

In this example ADMIN-enabled (1) is always enabled no matter if an user is ADMIN or not. Second one ADMIN-enabled (2) has correct behaviour (disabled if the user is not ADMIN).

ngxDisableElement is identical with your example:

this.ngxpcs.addPermissionStrategy('ngxDisableElement', (tF: TemplateRef<any>) => { this.renderer2.setAttribute(tF.elementRef.nativeElement.nextSibling, 'disabled', 'true'); });

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
NobodyIs001commented, Jun 13, 2019

Hi Alex,

thanks for info and feedback. Have a nice day 😃.

0reactions
fbaldo31commented, Oct 13, 2021

Same issue here, i use material icons in material stepper and icons cannot be rendered in a ng-template using ngxPermissions

Read more comments on GitHub >

github_iconTop Results From Across the Web

ngx-permissions not working in child-components (angular 14)
BUT when I add *ngxPermissionsOnly="['ADMIN']" to app.component.html it works! So It's facing the problem just for child components!
Read more >
Angular Ngxpermission Material Issue - StackBlitz
Starter project for Angular apps that exports to the Angular CLI.
Read more >
ngx-datepickerrange - npm Package Health Analysis - Snyk
This plugin have an independant theme which looks more close to material design, so the material design is just a style. demo: https://fetrarij....
Read more >
Android permissions - Material Design
Android apps have limited permissions associated with them by default. If your app selected to apply “normal” permissions, the system automatically grants ...
Read more >
Dealing With Permissions in Angular and NgRx
Using CanActivate guards only solves one part of the problem for us. ... In our example app, we designed the permission system for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found