Including HTML in Angular application at compile time

Solution 1:

It's not in the compilation time, but a way to do something similar to what you are asking, is this:

You could have your "loading screen" html code as a component (for instance, app-loading-component), declared and exported inside a Shared Module.

Then, in the component 'X' in which you want to use it, you have to import the Shared Module in the section imports:[] of the module of that 'X' component, and used it in your HTML in the usual way:

<app-loading-component></app-loading-component>