diff --git a/src/app/showcase/doc/tree/lazydoc.ts b/src/app/showcase/doc/tree/lazydoc.ts index bdd19d2c810..e83f4de0da2 100644 --- a/src/app/showcase/doc/tree/lazydoc.ts +++ b/src/app/showcase/doc/tree/lazydoc.ts @@ -1,4 +1,4 @@ -import { ChangeDetectorRef, Component, OnInit } from '@angular/core'; +import { Component, OnInit, ChangeDetectorRef } from '@angular/core'; import { MessageService, TreeNode } from 'primeng/api'; import { Code } from '../../domain/code'; import { NodeService } from '../../service/nodeservice'; @@ -55,7 +55,7 @@ export class LazyDoc implements OnInit { `, typescript: ` -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit, ChangeDetectorRef } from '@angular/core'; import { MessageService, TreeNode } from 'primeng/api'; import { NodeService } from '../../service/nodeservice'; @@ -69,13 +69,14 @@ export class TreeLazyDemo implements OnInit { files!: TreeNode[]; - constructor(private nodeService: NodeService, private messageService: MessageService) { } + constructor(private nodeService: NodeService, private messageService: MessageService, private cd: ChangeDetectorRef) {} ngOnInit() { this.loading = true; setTimeout(() => { this.nodeService.getLazyFiles().then((files) => (this.files = files)); this.loading = false; + this.cd.markForCheck(); }, 1000); } @@ -88,6 +89,7 @@ export class TreeLazyDemo implements OnInit { this.messageService.add({ severity: 'info', summary: 'Children Loaded', detail: event.node.label }); }); this.loading = false; + this.cd.markForCheck(); }, 200); } }