B
B
beta-it2018-03-25 13:18:24
Angular
beta-it, 2018-03-25 13:18:24

How to sequentially execute two or more subscribe?

I have this code (it works):

deleteRecord(event: IEvent): void {
   this.dialog.confirm(
      'Подтвердите Ваше действие',
      `Подтвердите удаление записи <strong>${event.title}</strong>`)
      .subscribe(
        result => {
          if (result) {
            this.deleteService.deleteRecord(event.id)
              .subscribe(
                success => {
                  this.alert.info(`Событие - ${event.title} удалено!`);
                  this.logger.log('delete success', success);
                },
                error => {
                  this.logger.error('delete error', error);
                }
              );
          }
        }
      );
  }

The question is, how can you get rid of this 'subscribe' ladder in your code?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Shvedov, 2018-03-25
@beta-it

map or mergeMap rxjs methods

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question