diff --git a/apps/angular/59-content-projection-defer/src/app/page-2.ts b/apps/angular/59-content-projection-defer/src/app/page-2.ts index 5665466d8..1b06e1015 100644 --- a/apps/angular/59-content-projection-defer/src/app/page-2.ts +++ b/apps/angular/59-content-projection-defer/src/app/page-2.ts @@ -3,6 +3,7 @@ import { ChangeDetectionStrategy, Component, ResourceStatus, + viewChild, } from '@angular/core'; import { ExpandableCard } from './expandable-card'; @@ -36,8 +37,13 @@ interface Post { imports: [ExpandableCard], }) export class Page2 { - public postResource = httpResource( - 'https://jsonplaceholder.typicode.com/posts', - ); + private expandableCard = viewChild(ExpandableCard); + + public postResource = httpResource(() => { + return this.expandableCard()?.isExpanded() + ? 'https://jsonplaceholder.typicode.com/posts' + : undefined; + }); + protected readonly ResourceStatus = ResourceStatus; }