|
1 | 1 | .callout.is-helpful
|
2 | 2 | header Angular is in developer preview
|
3 | 3 | p.
|
4 |
| - This quickstart does not |
5 |
| - reflect the final development process for Angular. The following setup is for those who |
6 |
| - want to try out Angular while it is in developer preview. |
| 4 | + This quickstart does not reflect the final development process for writing apps with Angular. |
| 5 | + The following setup is for those who want to try out Angular while it is in developer preview. |
7 | 6 |
|
8 | 7 | // STEP 1 - Create a project ##########################
|
9 | 8 | .l-main-section
|
|
15 | 14 |
|
16 | 15 | p.
|
17 | 16 | The goal of this quickstart is to write a component in TypeScript that prints a string.
|
18 |
| - To get started, clone the TypeScript quickstart repository: |
| 17 | + We assume you have already installed <a href="https://docs.npmjs.com/getting-started/installing-node">Node and npm</a>. |
19 | 18 |
|
20 |
| - pre.prettyprint |
21 |
| - $ git clone https://github.com/angular/ts-quickstart.git |
22 |
| - $ cd ts-quickstart |
| 19 | + p. |
| 20 | + To get started, create a new empty project directory. All the following commands should be run |
| 21 | + from this directory. |
23 | 22 |
|
24 | 23 | p.
|
25 |
| - For the sake of this quickstart we recommend using the |
26 |
| - <a href="https://github.com/angular/ts-quickstart"> <code>quickstart</code> GitHub repository</a>. |
27 |
| - This repository provides a faster start than building from <code>npm</code>. |
28 |
| - This repository includes the Angular distribution and type definitions for TypeScript. |
29 |
| - |
| 24 | + To get the benefits of TypeScript, we want to have the type definitions available for the compiler and the editor. |
| 25 | + TypeScript type definitions are typically published in a repo called <a href="http://definitelytyped.org/">DefinitelyTyped</a>. |
| 26 | + To fetch one of the type definitions to the local directory, we use the <a href="https://www.npmjs.com/package/tsd">tsd package manager</a>. |
| 27 | + |
| 28 | + pre.prettyprint |
| 29 | + $ npm install -g tsd |
| 30 | + $ tsd query angular2 --action install |
| 31 | + |
30 | 32 | p.
|
31 |
| - Create two files, <code>index.html</code> and |
32 |
| - <code>app.ts</code>, both at the root of the project: |
| 33 | + Next, create two empty files, <code>index.html</code> and <code>app.ts</code>, both at the root of the project: |
33 | 34 |
|
34 | 35 | pre.prettyprint
|
35 |
| - $ touch app.ts index.html |
| 36 | + $ touch app.ts index.html |
36 | 37 |
|
37 | 38 | // STEP 2 - Start the TypeScript compiler ##########################
|
38 | 39 | .l-main-section
|
|
43 | 44 | your code to browser-compliant JavaScript as you work. This quickstart uses the TypeScript
|
44 | 45 | compiler in <code>--watch</code> mode, but it is also possible to do the translation in the browser as files
|
45 | 46 | are loaded, or configure your editor or IDE to do it.
|
46 |
| - p. |
47 |
| - The repository includes a file <code>tsconfig.json</code>. |
48 |
| - Many tools — including the TypeScript compiler — |
49 |
| - know to read this file so we don't need to configure them or add command-line options. |
50 | 47 |
|
51 | 48 | pre.prettyprint
|
52 | 49 | $ npm install -g typescript@^1.5.0-beta
|
53 |
| - $ tsc --watch |
| 50 | + $ tsc --watch -m commonjs -t es5 --emitDecoratorMetadata app.ts |
54 | 51 |
|
55 | 52 | // STEP 3 - Import Angular ##########################
|
56 | 53 | .l-main-section
|
|
188 | 185 | <head>
|
189 | 186 | <title>Angular 2 Quickstart</title>
|
190 | 187 | <script src="https://github.jspm.io/jmcriffey/ [email protected]/traceur-runtime.js" ></script >
|
191 |
| - <script src="https://github.com/%3Cspan%20class="x x-first x-last">bundle/angular2.dev.js"></script> |
| 188 | + <script src="https://github.com/%3Cspan%20class="x x-first x-last">https://code.angularjs.org/2.0.0-alpha.22/angular2.dev.js"></script> |
192 | 189 | </head>
|
193 | 190 | <body>
|
194 | 191 |
|
|
224 | 221 | <title>Angular 2 Quickstart</title>
|
225 | 222 | <script src="https://github.jspm.io/jmcriffey/ [email protected]/traceur-runtime.js" ></script >
|
226 | 223 | <script src="https://jspm.io/ [email protected]" ></script >
|
227 |
| - <script src="https://github.com/%3Cspan%20class="x x-first x-last">bundle/angular2.dev.js"></script> |
| 224 | + <script src="https://github.com/%3Cspan%20class="x x-first x-last">https://code.angularjs.org/2.0.0-alpha.22/angular2.dev.js"></script> |
228 | 225 | </head>
|
229 | 226 |
|
230 | 227 | p.
|
231 |
| - Add the following module-loading code before the <code><my-app></code> tag: |
| 228 | + Add the following module-loading code: |
232 | 229 |
|
233 | 230 | pre.prettyprint.linenums
|
234 | 231 | code.
|
|
0 commit comments