We begin by creating a new project based on the source code from the Angular 2 QuickStart project. You can either clone it from the GitHub repository or extract it from a ZIP package, as described next.
Note
|
If you are not yet familiar with Angular 2, please go through the Angular 2 QuickStart tutorial, which explains every step of starting a new Angular 2 application from scratch. |
Clone the Angular 2 QuickStart repository into the tutorial project folder:
$ git clone https://github.com/angular/quickstart my-project $ cd my-project
We are not going to contribute to the quickstart repository itself, so the original repository data is not needed. Remove the .git repository data folder.
Alternatively, instead of using Git to clone the QuickStart repository, you can download and extract the QuickStart zip package.
The QuickStart respository contains tests for the AppComponent class. Unfortunately, some changes that will be done to AppComponent in this tutorial would break the compilation of these tests.
Please remove the app/app.component.spec.ts file to prevent compilation errors later in this tutorial.
Note
|
Testing in Angular 2
Testing is out of the scope of this tutorial. See the Testing chapter in the Angular 2 Developer Guide for more information on the topic. |
Install npm dependencies:
$ npm install
At this point, you should be able to compile the TypeScript source code and launch the development server. You can start the server to check that everything is fine:
$ npm start
Press kbd:[Ctrl+C] to stop the development server.
Tip
|
See the Angular 2 QuickStart README for more information about creating a new project and other useful npm commands. |