Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@ngrx/component: Add suspense template as input of LetDirective #3340

Closed
markostanimirovic opened this issue Mar 9, 2022 · 0 comments · Fixed by #3377
Closed

@ngrx/component: Add suspense template as input of LetDirective #3340

markostanimirovic opened this issue Mar 9, 2022 · 0 comments · Fixed by #3377

Comments

@markostanimirovic
Copy link
Member

Add new input to the LetDirective that accepts suspense template:

@Component({
  selector: 'ngrx-posts',
  template: `
    <ul *ngrxLet="posts$ as posts; suspenseTpl: loading">
      <li *ngFor="let post of posts">{{ post.name }}</li>
    </ul>
    <ng-template #loading>
      <p>Loading...</p>
    </ng-template>
  `
})
export class PostsComponent {
  readonly posts$ = this.postsService.getPosts();

  constructor(private readonly postsService: PostsService) {}
}

The suspense template should be displayed when passed Observable is in a suspense state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

1 participant