Getting Started with Angular2
- Latest version of nodejs and npm
You must have installed nodejs in your system before starting with angular2. I am assuming you are already installed node js and npm.
You can start a angular 2 project with different method
- Manual Installation
- Quick Start Method
- Using Angular CLI
Here we are going to describe how to configure angular2 manually.
1. Install TypeScript
Initially we need to install the typescript as global installation.
-g Option is used to install it global, We can install a node module as global or locally –save option is used to install node module locally.
2. Create your project folder and navigate to project folder
Here am creating angular2sample as my project folder
3. Generate your typescript config file
For the typescript compilation we need to initialize the typescript config file in our root directory by using following commands.
we already installed the type script globally, so we can use tsc commands in your terminal. We are used the following parameter here
–init : used to initialize the tsconfig.json files.
–target : It tell the code is compile in EMCASCRIPT 5.
–sourceMap : Generate source map file, For debug purpose.
–experimentalDecorators and –emitDecoratorMetadata : Used for decorators.
Your generated tsconfig.json looks like following code
4. Generate package.json file
We need to generate our package.json file using following command
Enter with default options it will create the package.json file with following code.
"description": "Angular2 Sample project",
"test": "echo "Error: no test specified" && exit 1"
"author": "Habid PK",
5. Install angular2 dependency
In the next step we need to install angular2 local