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 all 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 } from '@angular/core';
import { Component, OnInit, AfterViewChecked, ChangeDetectorRef } from '@angular/core';
import { AuthService } from '../../services/auth.service';

/**
Expand All @@ -9,12 +9,36 @@ 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 authService
* @param changeDetector
*/
constructor(
public authService: AuthService
public authService: AuthService,
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();
}
}
}