diff --git a/src/app/directives/has-permission/has-permission.directive.ts b/src/app/directives/has-permission/has-permission.directive.ts index 63c5ec812..145ff7e0b 100644 --- a/src/app/directives/has-permission/has-permission.directive.ts +++ b/src/app/directives/has-permission/has-permission.directive.ts @@ -36,12 +36,11 @@ export class HasPermissionDirective { if (typeof permission !== 'string') { throw new Error('hasPermission value must be a string'); } + /** Clear the template beforehand to prevent overlap OnChanges. */ + this.viewContainer.clear(); + /** Shows Template if user has permission */ if (this.hasPermission(permission)) { - /** Shows Template */ this.viewContainer.createEmbeddedView(this.templateRef); - } else { - /** Hides Template */ - this.viewContainer.clear(); } }