Angular Change Detection

// component 1
<button (click)="open()">Click</button>
// 1 ts
open(){
this.appService.buttonClicked = true; // appServic is global provider
}

// component 2
<div [ngClass]={ 'disabled' : appService.buttonClicked }>
</div>
// component 1
<button (click)="open()">Click</button>
// 1 ts
open(){
this.appService.buttonClicked = true; // appServic is global provider
}

// component 2
<div [ngClass]={ 'disabled' : appService.buttonClicked }>
</div>
this is simple example for what I'm trying to achieve this is working Fine but I'm getting this exception ERROR Error: ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: 'disabled: true'. Current value: 'disabled: false'
Idk how to solve this
0 Replies
No replies yetBe the first to reply to this messageJoin