Re-using an RxJS Observable to repeat an asynchronous call?
问题 How can an RxJS Observable emit a new value, if the underlying event stream doesn't emit a new value? Given an Angular component which uses an async pipe to display a user's name; export class MyComponent implements OnInit { public user$!: Observable<User>; constructor(private readonly ms: MyService) ngOnInit() { this.user$ = this.ms.getUser(); } } <ng-container *ngIf="user$ | async as user; else empty"> {{ user.name }} </ng-container> <ng-template #empty> No user here. </ng-template> ..