Skip to content

Commit

Permalink
fix: trigger change detection in the authorization toggle directive a…
Browse files Browse the repository at this point in the history
…fter permission changes
  • Loading branch information
SGrueber committed Jun 16, 2021
1 parent 2096b26 commit 74810ed
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/app/core/directives/authorization-toggle.directive.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand All @@ -14,6 +14,7 @@ export class AuthorizationToggleDirective implements OnDestroy {
private destroy$ = new Subject();

constructor(
private cdRef: ChangeDetectorRef,
private templateRef: TemplateRef<unknown>,
private viewContainer: ViewContainerRef,
private authorizationToggle: AuthorizationToggleService
Expand All @@ -24,6 +25,7 @@ export class AuthorizationToggleDirective implements OnDestroy {
} else {
this.viewContainer.clear();
}
this.cdRef.markForCheck();
});
}

Expand Down

0 comments on commit 74810ed

Please sign in to comment.