From 74810ed9a95d386b4b9929055676a8b1817fc706 Mon Sep 17 00:00:00 2001 From: Silke Date: Tue, 15 Jun 2021 14:36:32 +0200 Subject: [PATCH] fix: trigger change detection in the authorization toggle directive after permission changes --- src/app/core/directives/authorization-toggle.directive.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/app/core/directives/authorization-toggle.directive.ts b/src/app/core/directives/authorization-toggle.directive.ts index 196261ba15..c6093dc68f 100644 --- a/src/app/core/directives/authorization-toggle.directive.ts +++ b/src/app/core/directives/authorization-toggle.directive.ts @@ -1,4 +1,4 @@ -import { Directive, Input, OnDestroy, TemplateRef, ViewContainerRef } from '@angular/core'; +import { ChangeDetectorRef, Directive, Input, OnDestroy, TemplateRef, ViewContainerRef } from '@angular/core'; import { ReplaySubject, Subject, Subscription } from 'rxjs'; import { distinctUntilChanged, takeUntil } from 'rxjs/operators'; @@ -14,6 +14,7 @@ export class AuthorizationToggleDirective implements OnDestroy { private destroy$ = new Subject(); constructor( + private cdRef: ChangeDetectorRef, private templateRef: TemplateRef, private viewContainer: ViewContainerRef, private authorizationToggle: AuthorizationToggleService @@ -24,6 +25,7 @@ export class AuthorizationToggleDirective implements OnDestroy { } else { this.viewContainer.clear(); } + this.cdRef.markForCheck(); }); }