Skip to content

Commit 86d0578

Browse files
authored
Merge branch 'angular:main' into dev
2 parents 3ad28e3 + f22c72b commit 86d0578

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

adev/src/content/tutorials/first-app/steps/14-http/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,8 @@ The data source has been configured, the next step is to update your web app to
169169
HELPFUL: For this example, the code uses `fetch`. For more advanced use cases consider using `HttpClient` provided by Angular.
170170

171171
1. Update the `getHousingLocationsById` function to make a call to the web server you configured.
172+
173+
HELPFUL: Notice the `fetch` method has been updated to _query_ the data for location with a matching `id` property value. See [URL Search Parameter](https://developer.mozilla.org/en-US/docs/Web/API/URL/search) for more information.
172174

173175
<docs-code header="" path="adev/src/content/tutorials/first-app/steps/14-http/src-final/app/housing.service.ts" visibleLines="[15,18]"/>
174176

adev/src/content/tutorials/first-app/steps/14-http/src-final/app/housing.service.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ export class HousingService {
1313
}
1414

1515
async getHousingLocationById(id: number): Promise<HousingLocation | undefined> {
16-
const data = await fetch(`${this.url}/${id}`);
17-
return (await data.json()) ?? {};
16+
const data = await fetch(`${this.url}?id=${id}`);
17+
const locationJson = await data.json();
18+
return locationJson[0] ?? {};
1819
}
1920

2021
submitApplication(firstName: string, lastName: string, email: string) {

0 commit comments

Comments
 (0)