Skip to content

Commit

Permalink
fix change in expression value
Browse files Browse the repository at this point in the history
  • Loading branch information
gautamjajoo committed Jul 25, 2021
1 parent 9eb4de3 commit fc17700
Showing 1 changed file with 20 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, OnInit, Inject, OnDestroy } from '@angular/core';
import { Component, OnInit, Inject, OnDestroy, AfterViewChecked, ChangeDetectorRef } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router';
import { DOCUMENT } from '@angular/common';
import { GlobalService } from '../../services/global.service';
Expand All @@ -12,7 +12,10 @@ import { AuthService } from '../../services/auth.service';
templateUrl: './publiclists.component.html',
styleUrls: ['./publiclists.component.scss'],
})
export class PubliclistsComponent {
export class PubliclistsComponent implements AfterViewChecked {

isAuth = false;

/**
* Constructor.
* @param document Window document Injection.
Expand All @@ -26,6 +29,20 @@ export class PubliclistsComponent {
private route: ActivatedRoute,
@Inject(DOCUMENT) private document: Document,
public authService: AuthService,
private globalService: GlobalService
private globalService: GlobalService,
private cdRef : ChangeDetectorRef
) {}

/**
* DEV MODE:
* For resolving change in expression value after it is checked
*/

ngAfterViewChecked() {
let isAuth = this.authService.isAuth;
if(isAuth != this.isAuth) {
this.isAuth = isAuth;
this.cdRef.detectChanges();
}
}
}

0 comments on commit fc17700

Please sign in to comment.