AngularJS 2 with Node.js

Author - Neelam
8.09.2017
|
0 Comments
|

AngularJS 2 is the most popular Framework of Javascript which is used to build Web/Mobile applications in html and javascript. AngularJS 2 has the abilities to build apps for web, mobile web, native mobile and native desktop and it has features like Web Workers and server-side rendering.

AngularJS 2 installation in a window using CLI:

Angular CLI is the command line interface for AngularJS and fastest method to launch Angular 2 project.

1. First we need to install Node JS and npm (node package manager). As Angular2 uses Typescript (.ts file) so we need to run a compiler to convert them into .js, which can be done on-the-fly easily with Node.js and NPM. Download the Windows installer from the Nodes.jsĀ® web site and run the installer.

To check if node js and npm is installed properly in our machine, run this command:

node -v

It will return version of node js.

Then Run:

npm -p

If npm is installed successfully it will also return npm version.

2. Then install Angular CLI using this command:

npm install -g angular-cli

It will take some time to install full package so keep patience.

3. Now create new project folder:

ng new testproject
cd testproject
ng serve

Here, testproject is the name of the project we are creating. The ng new command will create new project directory and also install all of the required library files to node_module directory of our project.
ng serve is similar to npm start which is used to run the angular2 project. We need to run this command every time when we make some changes in our code.

This screenshot display the file structure of the angular Js 2 project:

1

Webner Solutions is a Software Development company focused on developing Insurance Agency Management Systems, Learning Management Systems and Salesforce apps. Contact us at dev@webners.com for your Insurance, eLearning and Salesforce applications.

Leave a Reply

Your email address will not be published. Required fields are marked *