Skip to content

Commit d1d348e

Browse files
committed
fix(tree-sample): add markForCheck in the remote data subscription #3967
1 parent 9c41845 commit d1d348e

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/app/lists/tree/tree-advanced-sample/tree-advanced-sample.component.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, AfterViewInit, OnDestroy, PLATFORM_ID, inject } from '@angular/core';
1+
import { Component, AfterViewInit, OnDestroy, PLATFORM_ID, inject, ChangeDetectorRef } from '@angular/core';
22
import { IgxIconComponent, IgxIconService } from 'igniteui-angular/icon';
33
import { IgxTreeComponent, IgxTreeNodeComponent } from 'igniteui-angular/tree';
44
import { IgxTooltipDirective, IgxTooltipTargetDirective } from 'igniteui-angular/directives';
@@ -19,6 +19,7 @@ export class TreeAdvancedSampleComponent implements AfterViewInit, OnDestroy {
1919
private iconService = inject(IgxIconService);
2020
private dataService = inject(DataService);
2121
private platformId = inject(PLATFORM_ID);
22+
private cdr = inject(ChangeDetectorRef);
2223

2324
public family = 'tree-icons';
2425
public data = DATA;
@@ -31,6 +32,7 @@ export class TreeAdvancedSampleComponent implements AfterViewInit, OnDestroy {
3132
this.dataService.data.pipe(takeUntil(this.destroy$)).subscribe((data) => {
3233
this.loading = false;
3334
this.remoteData = data;
35+
this.cdr.markForCheck();
3436
});
3537
}
3638

@@ -70,6 +72,7 @@ export class TreeAdvancedSampleComponent implements AfterViewInit, OnDestroy {
7072
}
7173
});
7274
}
75+
this.cdr.markForCheck();
7376
});
7477
}
7578
}

0 commit comments

Comments
 (0)