Does there exist something equivalent to the async
pipe that I could use inside a component like this
@Component({
selector: \'my-component
If you're in a Component
or something which has access to a ChangeDetectorRef
, you can do the following little trick:
@Component({
...
providers: [AsyncPipe]
})
export class ExampleComponent {
app$ = this.sandbox.allApps$;
apps = this.pipeAsync.transform(this.app$);
contructor(
protected pipeAsync: AsyncPipe,
protected sandbox: AppAppsSandbox
) {}
}
This assumes access to a service called AppAppsSandbox
, but the Observable
app$
can come from anywhere, this is a convenient way to unwrap it.