Angular for production
Run this command line in the Angular demo directory.
This build process will use method of ahead-of-time (AOT) compilation.
The ahead-of-time (AOT) compiler can catch template errors early and improve performance by compiling at build time.
The compiled Angular app will be in the folder
With AOT, the browser downloads a pre-compiled version of the application. The browser loads executable code so it can render the application immediately, without waiting to compile the app first.
ng build --prod
If you copy the files into a server sub-folder, append the build flag,
--base-href and set the
<base href> appropriately.
For example, if the
index.html is on the server at
/my/app/index.html, set the base href to
<base href="..//my/app/"> like this.
If you're serving the app out of a subfolder, edit a version of index.html to set the base href appropriately.
For example, if the URL to
www.mysite.com/my/app/index.html, set the base href to:
Learn more about the role of
<base href> below.
You also can set the base href right in the
ng build command
ng build --prod --base-href="..//my/app/"
For more detailed information, visit this official Angular documentation website.