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
Show file tree
Hide file tree
Changes from 3 commits
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,13 +1,13 @@
<app-side-bar *ngIf="authService.isAuth"></app-side-bar>
<app-side-bar *ngIf="isAuth"></app-side-bar>
<app-header-static></app-header-static>
<div class="web-container" [class.center]="!authService.isAuth">
<div class="web-container" [class.center]="!isAuth">
<div class="dashboard-flex">
<div class="dashboard-content">
<router-outlet></router-outlet>
</div>
<app-footer [isDash]="true" *ngIf="authService.isAuth"></app-footer>
<app-footer [isDash]="true" *ngIf="isAuth"></app-footer>
</div>
</div>
<div class="clearfix"></div>

<app-footer *ngIf="!authService.isAuth"></app-footer>
<app-footer *ngIf="!isAuth"></app-footer>
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 OnInit, AfterViewChecked {

isAuth = false;

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

/**
* Component on Initialization.
*/
ngOnInit() {
this.isAuth = this.authService.isAuth;
}

/**
* 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();
}
}
}