By Ben Nadel on

Once I learned that the in-browser TypeScript transpiler was dropping support for type-checking (one of the main reasons I’m using TypeScript), I decided it was time to start learning how to compile my Angular 2 demos offline using the tsc compiler. The tsc compiler can save the generated files to a different directory; but, in order to keep the relative templateUrl and styleUrls component meta-data working, I’m having the tsc compiler save the generated JS files right alongside the original TS files. As I was tinkering with this, however, I came across the Angular 2 Docs change-log in which they outlined a new way to load component-relative assets. Rather than providing the moduleId meta-data (and Node’s token), they are using a System.js loader that translates relative paths on-the-fly as the application is loading. Since I’m still using System.js to load my already-compiled files, I figured this is a change that I should make in my Angular 2 demos as well.

Source: Relative Template And Style URLs Using System.js Without moduleId In Angular 2.4.9

Posted in: Articles.
Last Modified: March 23, 2017

Leave a Reply