Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix console error of change in expression value #3550

Merged
merged 5 commits into from
Aug 26, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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();
}
}
}