@@ -129,6 +129,24 @@ code-example(format='.').
129
129
The `"skipMetadataEmit" : true` property prevents the compiler from generating metadata files with the compiled application.
130
130
Metadata files are not necessary when targeting TypeScript files, so there is no reason to include them.
131
131
132
+ :marked
133
+ ***Component-relative Template URLS***
134
+
135
+ The AoT compiler requires that `@Component` URLS for external templates and css files be _component-relative_.
136
+ That means that the value of `@Component.templateUrl` is a URL value _relative_ to the component class file.
137
+ For example, an `'app.component.html'` URL means that the template file is a sibling of its companion `app.component.ts` file.
138
+
139
+ While JiT app URLs are more flexible, stick with _component-relative_ URLs for compatibility with AoT compilation.
140
+
141
+ JiT-compiled applications that use the SystemJS loader and _component-relative_ URLs *must set the* `@Component.moduleId` *property to* `module.id`.
142
+ The `module` object is undefined when an AoT-compiled app runs.
143
+ The app fails with a null reference error unless you assign a global `module` value in the `index.html` like this:
144
+ + makeExample('cb-aot-compiler/ts/index.html' ,'moduleId' )( format ='.' )
145
+ .l-sub-section
146
+ :marked
147
+ Setting a global `module` is a temporary expedient.
148
+
149
+ :marked
132
150
### Compiling the application
133
151
134
152
Initiate AoT compilation from the command line using the previously installed `ngc` compiler by executing:
@@ -376,22 +394,6 @@ a#toh
376
394
app/main.ts (JiT)`
377
395
)
378
396
379
- :marked
380
- ***Component-relative Template URLS***
381
-
382
- The AoT compiler requires that `@Component` URLS for external templates and css files be _component-relative_.
383
- That means that the value of `@Component.templateUrl` is a URL value _relative_ to the component class file.
384
- For example, a `'hero.component.html'` URL means that the template file is a sibling of its companion `hero.component.ts` file.
385
-
386
- While JiT app URLs are more flexible, stick with _component-relative_ URLs for compatibility with AoT compilation.
387
-
388
- JiT-compiled applications that use the SystemJS loader and _component-relative_ URLs *must set the* `@Component.moduleId` *property to* `module.id`.
389
- The `module` object is undefined when an AoT-compiled app runs.
390
- The app fails with a null reference error unless you assign a global `module` value in the `index.html` like this:
391
- + makeExample('toh-6/ts/aot/index.html' ,'moduleId' )( format ='.' )
392
- .l-sub-section
393
- :marked
394
- Setting a global `module` is a temporary expedient.
395
397
:marked
396
398
***TypeScript configuration***
397
399
0 commit comments