да, то расскажите вкратце пж, спасибо
                  
                  
                  вот пример:
                  
                  
                  —
                  
                  
                  const lastNotify = this.chatService.getNotify();
                  
                  
                  lastNotify.pipe(map(notify => console.log(notify))).toPromise().then();
                  
                  
                  —
                  
                  
                  this.chatService.getNotify().pipe(map(notify => console.log(notify))).toPromise().then();
                  
                  
                  —
                  
                  
                
Я бы не добавлял. Ну и toPromise() плохая практика. Хотя бы take(1) тогда в пайп прописать
не вижу необходимости в этой переменной = проще без, значит она и не нужна
Если вы результат будете выводить в шаблоне, то имеет смысл сделать, что-то типа такого readonly lastNotify$ = this.chatService.getNotify().pipe(map(notify => console.log(notify))) И потом в шаблоне <div *ngif = «lastNotify$ | async as lastNotify»>{{ lastNotify.myField }} </div>
Обсуждают сегодня