When you are ready to deploy your Angular Application to a remote server, you have various options for deployment.
For the simplest deployment, create a production build and copy the output directory to a web server.
ng build
index.html
.
index.html
is on the server at
/my/app.index.html
, set the base href to
<base href="/my/app/">
like this.
index.html
is
www.abc.com/my/app/index.html
, set the base href to
<base href="/my/app/">
ng build
command.
ng build --base-href="/my/app/"
This is the simplest production-ready deployment of your application. For more
detailes information, visit this official Angular Documentation
Website.
An Angular Application consists mainly of components and their HTML templates.
Because the components and templates provided by Angular cannot be understood
by the browser directly, Angular applications require a compilation process
before they can run in a browser.
The Angular AOT compiler converts your Angular HTML and Typescript code into
efficient JavaScript code during the build phase before the browser downloads
and runs that code. Compiling your application during the build process provides
a faster rendering in the browser.
Angular offers two ways to compile your application:
ng build --aot