Angular 2 Installation CLI setup environment

Angular 2 Installation CLI setup environment

Today, We want to share with you Angular 2 Installation CLI setup environment.
In this post we will show you Angular 2 installation step by step Javascript Example, hear for Angular 2 or Angular Local Development Environment Setup we will give you demo and example for implement.
In this post, we will learn about Setting Up Your First Angular 2 Project with an example.

READ :  jQuery Disable Button Until Ajax Request Complete

Why to use Angular 2?

*] easier to understand.
*] minimal memory overhead

angular 2 : Features

faster and easier than Angularjs 1.

focused on mainly mobile apps

Source Code structure is very easy tosimplified

Simple Hello World Example : step By Step

Step 1 : create a directory/folder

mkdir infinityknow

cd infinityknow

step 2 : Creating Configuration Files

tsconfig.json

[php]
{
“compilerOptions”: {
“target”: “es5”,
“module”: “system”,
“moduleResolution”: “node”,
“sourceMap”: true,
“emitDecoratorMetadata”: true,
“experimentalDecorators”: true,
“removeComments”: false,
“noImplicitAny”: false
},
“exclude”: [
“node_modules”,
“typings/main”,
“typings/main.d.ts”
]
}
[/php]

step 3 : create a file : typings.json

typings.json

[php]
{
“globalDependencies”: {
“core-js”: “registry:dt/core-js#0.0.0+20160602141332”,
“jasmine”: “registry:dt/jasmine#2.2.0+20160621224255”,
“node”: “registry:dt/node#6.0.0+20160621231320”
}
}
[/php]

step 4 :create a file : package.json

package.json

[php]
{
“name”: “infinityknow”,
“version”: “1.0.0”,
“scripts”: {
“start”: “concurrent \”npm run tsc:w\” \”npm run lite\” “,
“tsc”: “tsc”,
“tsc:w”: “tsc -w”,
“lite”: “lite-server”,
“typings”: “typings”,
“postinstall”: “typings install”
},
“license”: “ISC”,
“dependencies”: {
“angular2”: “2.0.0-beta.7”,
“systemjs”: “0.19.22”,
“es6-promise”: “^3.0.2”,
“es6-shim”: “^0.33.3”,
“reflect-metadata”: “0.1.2”,
“rxjs”: “5.0.0-beta.2”,
“zone.js”: “0.5.15”
},
“devDependencies”: {
“concurrently”: “^2.0.0”,
“lite-server”: “^2.1.0”,
“typescript”: “^1.7.5”,
“typings”:”^0.6.8″
}
}
[/php]

READ :  how to get last inserted id in laravel 6?

step 5 : command prompt to run

-> npm install

step 6 : Creating Our First Angular Component

mkdir app
cd app

step 7: create a file app/environment_app.component.ts

[php]
import {Component, View} from “angular2/core”;
@Component({
selector: ‘my-app’
})
@View({
template: ‘

My First Angular 2 App


})
export class AppComponent {
}
[/php]

step 8 : create a file : environment_main.ts

environment_main.ts

[php]
import {bootstrap} from “angular2/platform/browser”
import {AppComponent} from “./environment_app.component”
bootstrap(AppComponent);
[/php]

step 9 : create a main file : index.html

index.html

[php]

my angular2 First Application : Hello World
https://cdnjs.cloudflare.com/ajax/libs/es6-shim/0.33.3/es6-shim.min.js
https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.20/system-polyfills.js
https://code.angularjs.org/2.0.0-beta.6/angular2-polyfills.js
https://code.angularjs.org/tools/system.js
https://code.angularjs.org/tools/typescript.js
https://code.angularjs.org/2.0.0-beta.6/Rx.js
https://code.angularjs.org/2.0.0-beta.6/angular2.dev.js

System.config({
transpiler: ‘typescript’,
typescriptOptions: { emitDecoratorMetadata: true },
packages: {‘app’: {defaultExtension: ‘ts’}},
map: { ‘app’: ‘./angular2/src/app’ }
});
System.import(‘app/environment_main’)
.then(null, console.error.bind(console));

READ :  Introduction To ASP.NET Delegates and Events in C#

Simple Loading…….


Solution of AngularJs All Problems For infinityknow.com

My First Web-Application in angularjs, So I am very happy and 1000+ more then people are used of infinityknow.com

[/php]

Step 10 : run your application

npm start

Leave a Comment