Subscription Handling Directive
npm install @ngneat/subscribe
Now we can import the SubscribeDirective
and use the subscribe
directive in our template:
import { SubscribeDirective } from '@ngneat/subscribe';
@Component({
imports: [SubscribeDirective],
template: `
<ng-container *subscribe="users$ as users; let error=error">
{{ users | json }}
{{ error }}
</ng-container>
`
})
class MyComponent {
users$ = inject(UserService).getUsers();
}