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:
To check if the user has any of the required roles to view the element you need to use the allowAny
input:
or use the shorter version
Selector | [c8yIfAllowed] |
Methods |
Inputs |
Accessors |
constructor(template: TemplateRef
|
||||||||||||
Parameters :
|
c8yIfAllowed |
One or many roles required for the element to be rendered |
c8yIfAllowedAllowAny |
Type : boolean
|
Switches to the mode where at least one of the provided roles is sufficient for the element to be rendered |
ngOnInit |
ngOnInit()
|
Returns :
void
|
c8yIfAllowed | ||||||
setc8yIfAllowed(roleIds: string | string[])
|
||||||
One or many roles required for the element to be rendered
Parameters :
Returns :
void
|
c8yIfAllowedAllowAny | ||||||
setc8yIfAllowedAllowAny(allowAny: boolean)
|
||||||
Switches to the mode where at least one of the provided roles is sufficient for the element to be rendered
Parameters :
Returns :
void
|