Angular 2 is the latest framework for building web applications using typescript. Recently, angular team is skipped the version 3.x because, router package is shipped with 3.x previously, so instead of putting into 3.x, choose to move to 4.x.

Friday, 21 October 2016

How to setup environment for Angular2

Setting up a new project on your machine is easy with the QuickStart seed, which is maintained on github.Before you start, Make sure you have node and npm installed
  1. Create a project folder 
  2. Clone  the QuickStart seed into your project folder.
  3. Install npm packages.
  4. Run npm start to launch the sample application.
git clone https://github.com/angular/quickstart.git quickstart cd quickstart npm install npm startcd quickstartnpm installnpm start
app
app.component.ts
app.module.ts
main.ts

app.component.ts :
It is the root component of what will become a tree of nested components as the application evolves.

import { Component } from '@angular/core';

@Component({
  selector: 'my-app',
  template: `<h1>Hello {{name}}</h1>`
})
export class AppComponent { name = 'Angular'; }


app.module.ts:
the root module that tells Angular how to assemble the application
import { NgModule }      from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent }  from './app.component';

@NgModule({
  imports:      [ BrowserModule ],
  declarations: [ AppComponent ],
  bootstrap:    [ AppComponent ]
})
export class AppModule { }

main.ts
Compiles the application with the JIT compiler & bootstraps the application to run in the browser.

import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule }              from './app.module';
platformBrowserDynamic().bootstrapModule(AppModule);


0 coment�rios:

Post a Comment

Labels

Online Training

Your Name :
Your Email: (required)
Your Message: (required)

Powered by Blogger.

Recent Posts

Find Us On Facebook

Popular Posts