core/common/if-allowed.directive.ts
A structural directive that conditionally includes a template only if the user has all or any of the roles passed as an input. By default the directive checks all roles:
Example :<button *c8yIfAllowed="['ROLE_RECORD_DELETE', 'ROLE_ENTRY_DELETE']" (click)="delete()" title="Delete">
Delete
</button>To check if the user has any of the required roles to view the element you need to use the allowAny input:
<button *c8yIfAllowed="['ROLE_RECORD_DELETE', 'ROLE_ENTRY_DELETE']; allowAny: true" (click)="delete()" title="Delete">
Delete
</button>or use the shorter version
Example :<button *c8yIfAllowed="['ROLE_RECORD_DELETE', 'ROLE_ENTRY_DELETE']; allowAny" (click)="delete()" title="Delete">
Delete
</button>
| Selector | [c8yIfAllowed] |
| Standalone | true |
No results matching.