Installing and Running Angular Application

Install application dependencies
I have downloaded new angular application folder structure to build my new application. When you open the root folder, you will see 'package.json' file. This file gives information about the application name, version, dependencies, scripts etc used / needed for the application.


To add all these dependencies, you have to open terminal and run the node command line.
npm install

All the dependencies are now added inside a folder named 'node_modules'.


Running applications
We will be using Angular CLI to run the application. Inside 'package.json', you will see 'scripts' and its property and values. It allows to either start, build or test application. For example:
"start": "ng serve -0"

where
'ng' executes Angular CLI,
'serve' is CLI command that builds the web server
'-0' is command option that opens URL in default browser

Now, in command prompt if you type
npm start
it will execute start script, build the application, starts web server and open the url in default browser.

Share this

Related Posts