Welcome to Angular..!
Angular is an application design framework and development platform for creating
efficient and sophisticated single-page apps. It helps you to build modern
applications for the Desktop, Web and Mobile.
This guide explains how to set up your environment for Angular development using
the Angular CLI tool. It includes information about prerequisites, installing
the CLI, creating an initial workspace and starter app, and running that app
locally to verify your setup.
For Installation of Angular Application you needs 3 things as Prerequisites.
To use the Angular Framework, you should be familiar with the following:
Angular requires a current, active LTS (long term support) or maintenance LTS
(long term support) version of Node.js.
Download latest version of node.js from nodejs.org.
Install Node.js using downloaded file.
To check your node version, run node -v in a terminal/console window (cmd)
The Angular CLI and Angular applications depend on npm packages for
many features and functions.
To download and install npm packages, you need an npm package manager.
This guide uses the npm client command line interface, which is installed with
Node.js by default.
To check that you have the npm client installed, run npm -v in a
terminal/console window (cmd)
For better understanding Angular we suggest you once go through official
documentation of Angular from Angular
Documentation
Install Node.js: Angular requires Node.js to be installed on your system. You can download and install Node.js from the official website: https://nodejs.org/.
Install Angular CLI: Once Node.js is installed, open your command prompt or terminal and run the following command to install Angular CLI:
npm install –g @angular/cli
This will install the latest version of Angular CLI globally on your system.
To create a new Angular project, navigate to the directory where you want to create the project using the command prompt or terminal and run the following command
ng new my-app
The Angular CLI installs the necessary Angular npm packages and other dependencies. This can take a few minutes. The CLI creates a new workspaces and a simple Welcome app, ready to run.
This will create a new Angular project named "my-app" in the current directory.
The Angular CLI includes a server, so that you can build and serve your app locally.
cd my-app
ng serve --open
The ng serve command launches the server, watches your files, and rebuilds
the
app as you make changes to those files.
The --open
or -o
just Option automatically opens
your
browser to http://localhost:4200/.
Download the Spruha.rar/zip file.
Extract it there you will find Spruha(main project file), Starter-kit(set of files and code that provides a basic structure and functionality for a specific type of application), Readme.txt, Documentation.
Go to the Spruha folder/directory. open the command prompt/ terminal run the below command.
npm install // If you faced any issue running "npm install" Please make sure to use,
npm install --force // This command will ignore if there was any dependency issue.
(or)
yarn install // yarn can handle dependency issues better than npm.
Once the installation was successful then you can find node_modules folder where all the downloaded libraries are available.
To serve the Angular project, In command prompt or terminal run the following command:
ng serve
Once you serve your application by default port is set to 4200 :http://localhost:4200/
To change the Angular port manually, you can specify the port number when running the ng serve command. By default, the port is set to 4200, but you can specify a different port number by appending `--port` followed by the desired port number.
ng serve --port 1234
An Angular Application consists mainly of components and their Angular 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 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