0

Taking my initial steps towards Angular 2.0.

First thing is to set up the right environment for the development.

My index.html

<!DOCTYPE HTML>
<html>

<head>
  <title>Welcome to Angular 2.0</title>
  <!--css-->
  <link rel="stylesheet" type="text/css" href="css/bootstrap.css" />
 </head>

 <body>
 <div class="container">
    <h1> Hello Angular 2 </h1>
      <my-app> Loading app component....<my-app>
</div>
<!--js-->
<!-- Polyfills for older browsers -->
<script src="https://unpkg.com/core-js/client/shim.min.js"></script>

<script src="https://unpkg.com/zone.js@0.7.4?main=browser"></script>
<script src="https://unpkg.com/reflect-metadata@0.1.8"></script>
<script src="https://unpkg.com/systemjs@0.19.39/dist/system.src.js">   </script>

<script> window.autoBootstrap = true; </script>

<script src="https://cdn.rawgit.com/angular/angular.io/b3c65a9/public/docs/_examples/_boilerplate/systemjs.config.web.js"></script>
<script>
    System.import('app').catch(function (e) { console.log(e); });
  </script>
  <!--js-->
 </body>

 </html>

I have copied the content from https://angular.io/docs/ts/latest/guide/setup.html for the following files:-

  • app.component.ts
  • app.module.ts
  • main.ts

NPM is installed & running.

NodeJS

But in order to get the node_modules folders with the required dependencies for the app to run. What commands do I need to run.

What are the commands that I need to run to set up the Angular 2 environment?

Please note I am new to NPM. Thanks.

Kgn-web
  • 7,047
  • 24
  • 95
  • 161

4 Answers4

2

You have angular-cli wich is a good starter point. It will set you everything up according to best practices.

Philippe Corrèges
  • 663
  • 1
  • 11
  • 31
2

Simple way to set up your first Angular 2 Application.

  1. Download the zip version here.firstAngular2App

  2. Extract it to your destination folder. Assume D:

  3. Open your command prompt(ensure that all required softwares are installed).

  4. Navigate it to the folder. Use the command cd D:\firstAngular2App

  5. Executre npm install

  6. Once it is done use npm start

This way you have your first Angular2 appliction up and running.

Aravind
  • 40,391
  • 16
  • 91
  • 110
1

npm install in the root project (it will create your node_modules from the dependencies mentioned in package.json file, should have those files as a start)

SeleM
  • 9,310
  • 5
  • 32
  • 51
0

If you are already using Visual Studio Code as an IDE, you may want to explore how they recommend setting up Angular. I personally found their installation guide painless and feature-rich. I have never walked through an official Angular installation before due to being drenched in jQuery projects. This guide was simple enough to give me a good beginners understanding.

klewis
  • 7,459
  • 15
  • 58
  • 102