I am getting the following error just in Firefox. Not in Chrome or IE.
"Error: Error in ./DefaultLayoutComponent class DefaultLayoutComponent - inline template:2:14 caused by: Expression has changed after it was checked. Previous value: 'over'. Current value: 'side'.”.
This is a sidenav styling from material design that is throwing this.
Here is line 2 of DefaultLayoutComponent html template :
<md-sidenav (mouseover)="toggleHover(true)" (mouseout)="toggleHover(false)" (close)="sidenavToggle(false)" (open)="sidenavToggle(true)" [mode]="(_navigation.mediumScreenAndDown && sidenavStyle !== 'off') ? 'over':sidenavMode" [ngClass]="{'icon-sidenav': ((sidenavStyle === 'icon' || sidenavStyle === 'icon overlay') && _navigation.largeScreen), 'over': (sidenavStyle === 'icon overlay')}">
Here is the method in the DefaultLayoutComponent typescript that gets called to determine sidenavStyle
public get sidenavMode(): string {
if(this.sidenavStyle === 'icon overlay' && this.isHovering) {
return 'over';
} else if(this.sidenavStyle === 'icon' || this.sidenavStyle === 'icon overlay') {
return 'side';
} else if(this.sidenavStyle === 'hidden') {
return 'over';
} else if(this.sidenavStyle === 'off') {
return 'over';
}
return this.sidenavStyle;
}
I have determined that this is a change detection problem and I found this stackoverflow Angular 2 - Expression has changed after it was checked where Gunter makes a suggestion to use ngOnChanges and then detect those changes, but I am still throwing the error.
ngOnChanges() {
this.sidenavMode; //method where I am determining sidenav style
this.changeDetectorRef.detectChanges();
}
I have tried this but I am still throwing the error. Any help greatly appreciated.