@@ -214,28 +214,31 @@ a#angular-configuration
214
214
:marked
215
215
## Angular configuration
216
216
217
- ## INTRODUCTION NEEDED
217
+ Angular configuration can make the difference between whether your app launches quickly or doesn't load at all.
218
218
219
219
a#base-tag
220
220
:marked
221
221
### The `base` tag
222
+
223
+ The HTML [_<base href="..."/>_](https://angular.io/docs/ts/latest/guide/router.html#!#base-href)
224
+ specifies a base path for resolving relative URLs to assets such as images, scripts, and style sheets.
225
+ For example, given the `<base href="/myapp/">`, the browser resolves a URL such as `some/place/foo.jpg`
226
+ into a server request for `myapp/some/place/foo.jpg`.
227
+ During navigation, the Angular router uses the _base href_ as the base path to component, template, and module files.
222
228
223
- ## FIX THIS PROSE
224
- There is an important configuration item in the Angular Router that needs to be adjusted for
225
- different environments:
226
- [the `base` tags `href` property](https://angular.io/docs/ts/latest/guide/router.html#!#base-href).
227
- This property tells the router what the app root URL is so that the router can match routes.
228
-
229
- On your development server, your app is most likely served at the root: `http://localhost:3000/`.
230
- Here you use `<base href="/">`, since `/` is the root of your app.
229
+ .l-sub-section
230
+ :marked
231
+ See also the [*APP_BASE_HREF*](../api/common/index/APP_BASE_HREF-let.html "API: APP_BASE_HREF") alternative.
232
+ :marked
233
+ In development, you typically start the server in the folder that holds `index.html`.
234
+ That's your root folder and you'd add `<base href="/">` near the top of `index.html` because `/` is the root of your app.
231
235
232
- But depending on the server setup that you use, the app can be served from a subfolder like
233
- `http://localhost:3000/myapp/` or `http://www.mysite.com/myapp/`, where `/myapp/` is the subfolder.
234
- In this case you should use `<base href="/myapp/">`, since `/myapp/` is the root of your app and
235
- not `/`.
236
+ But on your shared or production server, you might serve the app from a subfolder.
237
+ For example, when the URL to load the app is something like `http://www.mysite.com/myapp/`,
238
+ the subfolder is `myapp/` and you should add `<base href="/myapp/">` to the server version of the `index.html`.
236
239
237
- When your `base` tag is misconfigured your browser console will show several errors in the console,
238
- from missing files on wrong paths to router errors about missing routes .
240
+ When your `base` tag is misconfigured, the app fails to load and the browser console displays `404 - Not Found` errors
241
+ for the missing files. Look at where it _tried_ to find those files and adjust the base tag appropriately .
239
242
240
243
a#enableProdMode
241
244
:marked
@@ -297,6 +300,8 @@ a#server-configuration
297
300
298
301
### Why fallback to `index.html`?
299
302
303
+ a#deep-link
304
+ :marked
300
305
A routed application should support "deep links".
301
306
A _deep link_ is a URL that specifies a path to a component inside the app.
302
307
For example, `http://www.mysite.com/heroes/42` is a _deep link_ to the hero detail page
0 commit comments