Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

where to put toaster on http service calls typescript

 testApi(viewData: any): Observable<any> {

    return this.http
      .delete<any[]>(URL, viewData)
      .pipe(
        map((res: any) => {
		  // add snackbar or toast function here;
          return res;
        })
      )
      .pipe(
        catchError((error: any) => {
          // add snackbar or toast function here;
          return throwError(error);
        })
      );
  }
 
PREVIOUS NEXT
Tagged: #put #toaster #http #service #calls #typescript
ADD COMMENT
Topic
Name
3+9 =