Bonjour, question simple : est-il possible d'ajouter des données dans une variable de type : Observable<{ [key: string]: Thread }> ?
Voici ce que j'ai essayé :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7 export class ThreadService { newThreads: Thread[]; newThreadsId : string[]; threads: Observable<{ [key: string]: Thread }>; }
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8 addThread(newThread: Thread): void { this.threadService.newThreads.push(newThread); this.threadService.newThreadsId.push(newThread.id); let result = {[this.threadService.newThreadsId]: this.threadService.newThreads}; this.threadService.threads = Observable.of(result); }
Partager