Accueil>Tests>Questions>Comment est appelée cette façon de faire ?
```ts
interface UserData {
[key: string]: any;
}
class UserDataService {
private userData: BehaviorSubject<UserData> = new BehaviorSubject({});
private userData$: Observable<UserData> = this.userData.asObservable();
public setUserData(userData: UserData) {
this.userData.next(userData);
}
public getUserData(): Observable<UserData> {
return this.userData$;
}
public getUserDataByKey(key: string) {
return this.userData$.pipe(map((userData) => userData[key]));
}
}
```
Question du test Initiation à RxJS
Comment est appelée cette façon de faire ? ```ts interface UserData { [key: string]: any; } class UserDataService { private userData: BehaviorSubject<UserData> = new BehaviorSubject({}); private userData$: Observable<UserData> = this.userData.asObservable(); public setUserData(userData: UserData) { this.userData.next(userData); } public getUserData(): Observable<UserData> { return this.userData$; } public getUserDataByKey(key: string) { return this.userData$.pipe(map((userData) => userData[key])); } } ```
Intermédiaire
Comment s'appelle cette façon de procéder ?
interface UserData {
[key: string]: any;
}
class UserDataService {
private userData: BehaviorSubject<UserData> = new BehaviorSubject({});
private userData$: Observable<UserData> = this.userData.asObservable();
public setUserData(userData: UserData) {
this.userData.next(userData);
}
public getUserData(): Observable<UserData> {
return this.userData$;
}
public getUserDataByKey(key: string) {
return this.userData$.pipe(map((userData) => userData[key]));
}
}
Auteur: Amine BouchamStatut : PubliéeQuestion passée 88 fois
Modifier
0
Évaluations de la communautéPersonne n'a encore évalué cette question, soyez le premier !