Skip to content

Commit

Permalink
docs: fix typo in Universal guide (#24812)
Browse files Browse the repository at this point in the history
PR Close #24812
  • Loading branch information
gkalpak authored and mhevery committed Jul 10, 2018
1 parent 9ff4617 commit 529e4b1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions aio/content/guide/universal.md
Expand Up @@ -212,7 +212,7 @@ You can get runtime information about the current platform and the `appId` by in

### Build Destination

A Universal app is distributed in two parts: the server-side code that serves up the initial application, and the client-side code that's loaded in dynamically.
A Universal app is distributed in two parts: the server-side code that serves up the initial application, and the client-side code that's loaded in dynamically.

The Angular CLI outputs the client-side code in the `dist` directory by default, so you modify the `outputPath` for the __build__ target in the `angular.json` to keep the client-side build outputs separate from the server-side code. The client-side build output will be served by the Express server.

Expand All @@ -223,7 +223,7 @@ The Angular CLI outputs the client-side code in the `dist` directory by default,
"options": {
"outputPath": "dist/browser",
...
}
}
}
...
```
Expand All @@ -235,13 +235,13 @@ The Angular CLI outputs the client-side code in the `dist` directory by default,
The tutorial's `HeroService` and `HeroSearchService` delegate to the Angular `HttpClient` module to fetch application data.
These services send requests to _relative_ URLs such as `api/heroes`.

In a Universal app, HTTP URLs must be _absolute_, for example, `https://my-server.com/api/heroes`
In a Universal app, HTTP URLs must be _absolute_, for example, `https://my-server.com/api/heroes`
even when the Universal web server is capable of handling those requests.

You'll have to change the services to make requests with absolute URLs when running on the server
and with relative URLs when running in the browser.

One solution is to provide the server's runtime origin under the Angular [`APP_BASE_REF` token](api/common/APP_BASE_HREF),
One solution is to provide the server's runtime origin under the Angular [`APP_BASE_HREF` token](api/common/APP_BASE_HREF),
inject it into the service, and prepend the origin to the request URL.

Start by changing the `HeroService` constructor to take a second `origin` parameter that is optionally injected via the `APP_BASE_HREF` token.
Expand Down Expand Up @@ -288,7 +288,7 @@ This is also the place to register providers that are specific to running your a

### App server entry point

The `Angular CLI` uses the `AppServerModule` to build the server-side bundle.
The `Angular CLI` uses the `AppServerModule` to build the server-side bundle.

Create a `main.server.ts` file in the `src/` directory that exports the `AppServerModule`:

Expand Down

0 comments on commit 529e4b1

Please sign in to comment.