diff --git a/libs/angular-accelerator/src/lib/directives/if-permission.directive.ts b/libs/angular-accelerator/src/lib/directives/if-permission.directive.ts index 82023219..45d281a7 100644 --- a/libs/angular-accelerator/src/lib/directives/if-permission.directive.ts +++ b/libs/angular-accelerator/src/lib/directives/if-permission.directive.ts @@ -71,22 +71,24 @@ export class IfPermissionDirective implements OnInit { } ngOnInit() { - if (this.permission) { - if (this.negate === this.hasPermission(Array.isArray(this.permission) ? this.permission : [this.permission])) { - if (this.ocxIfPermissionElseTemplate) { - this.viewContainer.createEmbeddedView(this.ocxIfPermissionElseTemplate) - } else { - if (this.onMissingPermission === 'disable') { - this.renderer.setAttribute(this.el.nativeElement, 'disabled', 'disabled') - } else { - this.viewContainer.clear() - } - } + if ( + (this.permission && + this.negate === this.hasPermission(Array.isArray(this.permission) ? this.permission : [this.permission])) || + !this.permission + ) { + if (this.ocxIfPermissionElseTemplate) { + this.viewContainer.createEmbeddedView(this.ocxIfPermissionElseTemplate) } else { - if (this.templateRef) { - this.viewContainer.createEmbeddedView(this.templateRef) + if (this.onMissingPermission === 'disable') { + this.renderer.setAttribute(this.el.nativeElement, 'disabled', 'disabled') + } else { + this.viewContainer.clear() } } + } else { + if (this.templateRef) { + this.viewContainer.createEmbeddedView(this.templateRef) + } } }