The pipe function allows us to use multiple operators. The pipe function is the assembly line from your observable data source through your operators. Just like raw material in a factory goes through a series of steps before it becomes a finished product, source data can pass through a pipe-line of operators where you can manipulate, filter, and transform the data to fit your use case. It's not uncommon to use 5 (or more) operators within an observable chain, contained within the pipe function.
/** * Add a new experience * @param formValue */ public addExperience(formValue: EmployeeExperiences): void {this.employeeExperienceService.save(formValue,'Experience').pipe(catchError(err => {this.isError =true; this.outputMessage = `Error:${err.status}. It seems something went wrong, please try later or your items are up to date.`;
returnthrowError(err); }),takeUntil(this.onDestroy$) ).subscribe(res => {this.isSaved =true;this.outputMessage =`Great job! Your information has been saved correctly`;this.experienceList.push(res);this.emptyArray =false; }); }