CodeSolution

Please wait...

Angular 2 project setup and installation

Angular 2 project setup and installation

@Angular  @ setup  @ installation  @ web application  @ typescript  

Angular

Angular 2 is an open-source JavaScript framework to build web applications in HTML and JavaScript.  It was built by the developers at Google.

The src folder Structure

   src

       app

            app.component.css
            app.component.html
            app.component.spec.ts
            app.component.ts
            app.module.ts
       assets
            .gitkeep
       environments
            environment.prod.ts
            environment.ts
       favicon.ico
       index.html
       main.ts
       polyfills.ts
       styles.css
       test.ts
       tsconfig.app.json
       tsconfig.spec.json

Step 1. Set up the Development Environment 

     You need to set up your development environment before you can do anything.

      Install Node.js and npm on your machine.

      Then install the Angular CLI globally.

   npm install -g @angular/cli

Step 2. Create a new project

       Open a terminal window.

       Generate a new project by running the following commands:

    ng new application-name

Step 3: Serve the application

        Go to the project directory and launch the server.

    cd my-app
    ng serve --open

Using the --open (or just -o) option will automatically open your browser on http://localhost:4200/

Step 4: Edit your first Angular component

open src/app/app.component.ts file and you can change the title.

   export class AppComponent { 
      title = 'My First Angular App!';
   } 

Link: https://angular.io/guide/quickstart

Comments 0

Reply

>