Skip to content
Closed
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
1 change: 1 addition & 0 deletions src/components-examples/material/progress-bar/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ export {ProgressBarDeterminateExample} from './progress-bar-determinate/progress
export {ProgressBarIndeterminateExample} from './progress-bar-indeterminate/progress-bar-indeterminate-example';
export {ProgressBarQueryExample} from './progress-bar-query/progress-bar-query-example';
export {ProgressBarHarnessExample} from './progress-bar-harness/progress-bar-harness-example';
export {ProgressBarExpressionFixExample} from './progress-bar-expression-fix/progress-bar-expression-fix-example'
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<mat-progress-bar [mode]="mode" [value]="value"></mat-progress-bar>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Component, AfterViewInit, ChangeDetectorRef } from '@angular/core';

@Component({
selector: 'progress-bar-expression-fix-example',
templateUrl: './progress-bar-expression-fix-example.html',
})
export class ProgressBarExpressionFixExample implements AfterViewInit {
mode: 'determinate' | 'indeterminate' = 'determinate';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Converting to a signal would fix the issue in a nicer way.

value = 50;

constructor(private cdr: ChangeDetectorRef) {}

ngAfterViewInit(): void {
setTimeout(() => {
this.mode = 'indeterminate';
this.cdr.detectChanges(); // Fix Bug ExpressionChangedAfterItHasBeenCheckedError
});
}
}