3
Areareservadacomponentcomponent.html:2 ERROR Error: Expressionchangedafterithasbeencheckederror: Expression has changed after it was checked. Previous value: 'Hidden: Undefined'. Current value: 'Hidden: true'. viewDebugError (core.js:9771) at expressionChangedAfterItHasBeenCheckedError (core.js:9749) checkat checkBindingNoChanges (core.js:9916) checkat checkNoChangesNodeInline (core.js:13964) checkat NoChangesNode (core.js:13938) at debugCheckNoChangesNode (core.js:14767) at debugCheckRenderNodeFn (core.js:14707) At object.Eval [as updateRenderer] (Areareareservadacomponentcomponent.html:6) At object.debugUpdateRenderer [as updateRenderer] (core.js:14689) checkat NoChangesView (core.js:13778)
area-reserved-Component.component.html
<app-mapa-de-ferias [hidden]="MapaFeriasIsVisible"></app-mapa-de-ferias>
=========
Menucomponentcomponent.html
<a class="nav-link" [routerLink]="" (click)='MostrarMapaFerias()'>Mapa de Férias</a>
=======
import { Component, ViewChild, AfterViewInit } from '@angular/core';
import { MenuComponentComponent } from '../menu-component/menu-component.component';
@Component({
selector: 'app-area-reservada-component',
templateUrl: './area-reservada-component.component.html',
styleUrls: ['./area-reservada-component.component.css']
})
export class AreaReservadaComponentComponent implements AfterViewInit {
constructor() { }
@ViewChild(MenuComponentComponent) menu: MenuComponentComponent;
public MapaFeriasIsVisible: boolean;
ngAfterViewInit(): void {
if (this.menu.MapaFeriasIsVisible) {
this.MapaFeriasIsVisible = false;
} else {
this.MapaFeriasIsVisible = true;
}
}
}
=============================== Menucomponentcomponent.ts
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
@Component({
selector: 'app-menu-component',
templateUrl: './menu-component.component.html',
styleUrls: ['./menu-component.component.css']
})
export class MenuComponentComponent {
@Input() MapaFeriasIsVisible: boolean;
constructor()
{
}
public MostrarMapaFerias(): void
{
if (this.MapaFeriasIsVisible) {
this.MapaFeriasIsVisible = false;
} else {
this.MapaFeriasIsVisible = true;
}
}
}
The goal was to show and hide when clicked on the Map button vacation
Hi Amadeu, good evening! I suggest rewriting the issue so that it is easier to benefit the whole community. The problem
ExpressionChangedAfterItHasBeenCheckedError
seems pretty common and an answer here would help a lot... and for that, we just need you to restructure your question so that it doesn’t just seem like you share your code and expect a solution.– Tiago Cardoso