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.

can I use 'and' with ngxPermissionsOnly

See original GitHub issue

I’m submitting a…


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[x] Feature request
[x] Documentation issue or request

Current behavior

it looks to me that

<div *ngxPermissionsOnly="['ADMIN', 'GUEST']">
    <div>You can see this text congrats</div>
</div>

works like or and will show if ADMIN or if GUEST.

Expected behavior

I’m looking for and use case, is it possible with current version?

I imagine it might be like

<div *ngxPermissionsAnd="['canDoAction1', 'canDoAction2']">
    Congrats you can do both actions:
    <div>item 1 <button>action1</button></div>
    <div>item 2 <button>action2</button></div>
</div>

so the area will appear only if user has permission to do both actions

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
vetik32commented, Mar 10, 2018

role looks cleaner , thanks a lot

0reactions
AlexKhymenkocommented, Mar 12, 2018

You can try to use roleService.hasRole but its promise

Read more comments on GitHub >

github_iconTop Results From Across the Web

How make dynamically *ngxPermissionsOnly in angular 5?
I have created a menu dynamically and need to display according to permission but *ngxPermissionsOnly not working.
Read more >
ngx-permission documentation
Now you can use onlyForRoles and exceptRoles directives in your components: import { Component } from '@angular/core'; @Component({ template: `<div ...
Read more >
Angular Ngxpermission Material Issue - StackBlitz
only for demonstration - by default I'm not. ADMIN, so controls should be disabled or. invisible. </p>. <!-- CUSTOM BEHAVIOUR OF NGX-PERMISSIONS -->....
Read more >
Ngx-permissions Tutorial #1 - Installation and Basic Example
Copy link. Info. Shopping. Tap to unmute. If playback doesn't begin shortly, try restarting your device. Your browser can 't play this video....
Read more >
Extend the *ngIf Syntax to Create a Custom Permission Directive
In this article we will go over a very simple use case, but which could easily be extended and used in a real...
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