Skip to content

Commit 5c45280

Browse files
committed
- Updated example in documentation
- Updated imports of Angular request
1 parent a8c2ca0 commit 5c45280

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

docs/angular-support.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ Inside the component you can inject the service and just use it as you would wit
4949

5050
```typescript
5151
import { Component } from '@angular/core';
52+
import { throwError} from 'rxjs';
53+
import { catchError, map, retry } from 'rxjs/operators';
5254

5355
import type { OrganizationService } from './generated/services/OrganizationService';
5456

@@ -59,7 +61,7 @@ import type { OrganizationService } from './generated/services/OrganizationServi
5961
export class AppComponent {
6062
constructor(private readonly organizationService: OrganizationService) {
6163

62-
// Make a call
64+
// Supports making a simple call
6365
this.organizationService
6466
.createOrganization({
6567
name: 'OrgName',
@@ -69,12 +71,15 @@ export class AppComponent {
6971
console.log(organization);
7072
});
7173

72-
// Or even map result and retry on error
74+
// Or creating flows with rety(), catchError() and map()
7375
this.organizationService
7476
.getOrganizations()
7577
.pipe(
78+
retry(3),
79+
catchError(error =>
80+
throwError(error)
81+
),
7682
map(organizations => organizations[0]),
77-
retryWhen(error => error)
7883
)
7984
.subscribe(organization => {
8085
console.log(organization);

src/templates/core/angular/request.hbs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
import { HttpClient, HttpHeaders } from '@angular/common/http';
44
import type { HttpResponse, HttpErrorResponse } from '@angular/common/http';
5-
import { catchError, forkJoin, map, switchMap, of, throwError } from 'rxjs';
5+
import { forkJoin, of, throwError } from 'rxjs';
6+
import { catchError, map, switchMap } from 'rxjs/operators';
67
import type { Observable } from 'rxjs';
78

89
import { ApiError } from './ApiError';

0 commit comments

Comments
 (0)