Complete the code to inject the facade service into the component constructor.
constructor(private [1]: UserFacade) {}In Angular, services are injected by specifying a private variable name in the constructor. The variable name should be camelCase, like userFacade.
Complete the code to call the facade's method to load users inside ngOnInit.
ngOnInit() {
this.userFacade.[1]();
}The facade service typically provides a method named loadUsers to trigger loading users from the backend.
Fix the error in the facade service method to return the users observable.
getUsers(): Observable<User[]> {
return this.store.[1](selectUsers);
}dispatch which is for sending actions, not selecting data.subscribe inside the facade which breaks observable chaining.To get data from the store, the facade uses select with a selector function.
Fill both blanks to create a facade method that dispatches an action to add a user.
addUser(user: User) {
this.store.[1](new [2](user));
}select instead of dispatch.The facade dispatches an action to the store using dispatch. The action to add a user is typically named AddUserAction.
Fill all three blanks to create a facade observable for users with error handling.
users$ = this.store.[1](selectUsers).[2](catchError(() => of([]))); constructor(private store: Store) { this.users$ = this.users$.[3](); }
dispatch instead of select.pipe to chain operators.shareReplay.The facade selects users from the store using select, then uses pipe to add error handling with catchError. Finally, shareReplay is used to share the observable result efficiently.