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 the $error as a value to the LetDirective's context #3343

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

@ngrx/component: Add the $error as a value to the LetDirective's context #3343

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

Comments

@markostanimirovic
Copy link
Member

The type of $error property from LetDirective's context is boolean. It would be better to add the error as a value, so it can be used in the template:

<div *ngrxLet="books$ as books; let error = $error">
  <p *ngIf="error; else bookList">{{ error.message }}</p>

  <ng-template #bookList>
    <div *ngFor="let book of books">...</div>
  </ng-template>
</div>
@markostanimirovic markostanimirovic self-assigned this Mar 9, 2022
brandonroberts pushed a commit that referenced this issue May 20, 2022
Closes #3343 

BREAKING CHANGES:

The `$error` property from `LetDirective`'s view context is
a thrown error or `undefined` instead of `true`/`false`.

BEFORE:

```ts
<p *ngrxLet="obs$; $error as e">{{ e }}</p>
```

- `e` will be `true` when `obs$` emits error event.
- `e` will be `false` when `obs$` emits next/complete event.

AFTER:

```ts
<p *ngrxLet="obs$; $error as e">{{ e }}</p>
```

- `e` will be thrown error when `obs$` emits error event.
- `e` will be `undefined` when `obs$` emits next/complete event.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant