Error: Expression has changed after it was checked. Previous value: 'true'. Current value: 'false'

Errorlogger
0

Use OnPush strategy if your objects are immutable and you doesn't change the state of the objects in your component. It will perform better rather than default where each change of the object make run change detector to resolve changes. More or less similar is described in Change Detection Strategy: OnPush

To inform Angular that we are going to comply with the conditions mentioned before to improve performance, we will use the OnPush change detection strategy.

The Angular docs said



ChangeDetectionStrategy


Members

MemberValueDescription
OnPush
OnPush means that the change detector's mode will be initially set to CheckOnce.
Default
Default means that the change detector's mode will be initially set to CheckAlways.
I fixed this by adding ChangeDetectionStrategy from angular core.

import {  Component, ChangeDetectionStrategy } from '@angular/core';

@Component({
    changeDetection: ChangeDetectionStrategy.OnPush,
    selector: 'page1',
    templateUrl: 'page1.html',
})
Tags

Post a Comment

0Comments

Post a Comment (0)

#buttons=(Accept !) #days=(30)

Our website uses cookies to enhance your experience. Check Now
Accept !