|
1 |
| -extends ../../../ts/_cache/guide/setup.jade |
2 |
| - |
3 |
| -block includes |
4 |
| - include ../_util-fns |
5 |
| - - var _prereq = 'the Dart SDK'; |
6 |
| - - var _playground = 'repository'; |
7 |
| - - var _Install = 'Get'; |
8 |
| - //- npm/pub commands |
9 |
| - - var _install = 'get'; |
10 |
| - - var _start = 'serve'; |
11 |
| - |
12 |
| -block qs-seed |
13 |
| - :marked |
14 |
| - The <live-example name="quickstart">QuickStart project</live-example> can |
15 |
| - conveniently be used to seed new projects. It contains the following core files: |
16 |
| - |
17 |
| -block core-files |
18 |
| - +makeTabs(` |
19 |
| - quickstart/ts/app/app.component.ts, |
20 |
| - quickstart/ts/app/main.ts, |
21 |
| - quickstart/ts/index.html, |
22 |
| - quickstart/dart/pubspec.yaml, |
23 |
| - quickstart/ts/styles.css`, |
24 |
| - ',,,,quickstart', |
25 |
| - `app/app.component.ts, |
26 |
| - app/main.ts, |
27 |
| - index.html, |
28 |
| - pubspec.yaml, |
29 |
| - styles.css (excerpt)`) |
| 1 | +include ../_util-fns |
30 | 2 |
|
31 |
| - :marked |
32 |
| - These files are organized as follows: |
| 3 | +a#develop-locally |
| 4 | +:marked |
| 5 | + Setting up a new Angular project is quick and easy, |
| 6 | + using everyday Dart tools. |
| 7 | + |
| 8 | +.l-main-section#sdk |
| 9 | +:marked |
| 10 | + ## Prerequisites: Dart SDK & Dartium |
| 11 | + |
| 12 | + If you don't already have the **Dart SDK** and **Dartium**, get them. |
| 13 | + We recommend using the WebStorm IDE, as well. |
| 14 | + |
| 15 | + [Get Started](https://webdev.dartlang.org/guides/get-started) tells you how to get the tools. |
| 16 | + |
| 17 | + |
| 18 | +a#webstorm |
| 19 | +:marked |
| 20 | + ## Creating a project in WebStorm |
| 21 | + |
| 22 | + Using WebStorm to create an app is simple, once you complete some one-time setup. |
| 23 | + |
| 24 | + 1. Launch WebStorm. |
| 25 | + 1. If you haven't already done so, |
| 26 | + [configure Dart support in WebStorm](https://webdev.dartlang.org/tools/webstorm#configuring-dart-support). |
| 27 | + 1. Choose **Create New Project** from the welcome screen, |
| 28 | + or **File > New > Project...** from the menu. A dialog appears. |
| 29 | + 1. Select **Dart** from the list on the left. |
| 30 | + 1. Set the location and template: |
| 31 | + 1. In the **Location** input field, check that |
| 32 | + the project folder is where you want it. |
| 33 | + 1. Also in the **Location** field, |
| 34 | + change the name of the project from `untitled` to whatever you choose, such as `angular_quickstart`. |
| 35 | + 1. Make sure that **Generate sample content** is checked. |
| 36 | + 1. Select **Angular QuickStart Example** from the list. |
| 37 | + <br> |
| 38 | + The form should look similar to the following: |
| 39 | + <br> |
| 40 | + <img src="images/create-ng2-project.png" alt="A screenshot of the New Project dialog, with the specified selections" style="border:1px solid"> |
| 41 | + 1. Click **Create**. |
| 42 | + |
| 43 | + WebStorm takes several seconds to analyze the sources and do other housekeeping. |
| 44 | + This only happens once. After that, you'll be able to use WebStorm for the usual IDE tasks, |
| 45 | + including running the app. |
| 46 | + |
| 47 | + For more information on using WebStorm, see |
| 48 | + [Installing and Using WebStorm](https://webdev.dartlang.org/tools/webstorm). |
| 49 | + |
| 50 | + |
| 51 | +a#cli |
| 52 | +:marked |
| 53 | + ## Using a template from the command line |
33 | 54 |
|
34 |
| - .filetree |
35 |
| - .file angular_quickstart |
| 55 | + [Stagehand](http://stagehand.pub/) gives you |
| 56 | + command-line access to the same templates that WebStorm uses. |
| 57 | + Assuming the Dart SDK and |
| 58 | + [pub cache `bin` directory](https://www.dartlang.org/tools/pub/cmd/pub-global#running-a-script-from-your-path) |
| 59 | + are in your path, here's how you use Stagehand to create an Angular project. |
| 60 | + |
| 61 | + 1. Install or update stagehand: |
| 62 | + <br> |
| 63 | + `pub global activate stagehand` |
| 64 | + 1. Create a directory for your project: |
| 65 | + <br> |
| 66 | + `mkdir angular_quickstart; cd angular_quickstart` |
| 67 | + 1. Use Stagehand with the appropriate template to create a skeleton app: |
| 68 | + <br> |
| 69 | + `stagehand web-angular-quickstart` |
| 70 | + <br> |
| 71 | + **Note:** |
| 72 | + Examples in this guide and tutorial are based on the QuickStart example, |
| 73 | + which is in the `web-angular-quickstart` template. |
| 74 | + A more general-purpose template is `web-angular`. |
| 75 | + 1. Get the app's dependencies: <br> |
| 76 | + `pub get` |
| 77 | + 1. Run the app: <br> |
| 78 | + `pub serve` |
| 79 | + |
| 80 | + |
| 81 | +.l-main-section#seed |
| 82 | +:marked |
| 83 | + ## What's in the QuickStart example? |
| 84 | + |
| 85 | + The <live-example name="quickstart">QuickStart example</live-example> |
| 86 | + contains the following core files: |
| 87 | + |
| 88 | ++makeTabs(` |
| 89 | + quickstart/ts/app/app.component.ts, |
| 90 | + quickstart/ts/app/main.ts, |
| 91 | + quickstart/ts/index.html, |
| 92 | + quickstart/ts/styles.css, |
| 93 | + quickstart/dart/pubspec.yaml`, |
| 94 | + ',,,quickstart,', |
| 95 | + `app/app.component.ts, |
| 96 | + app/main.ts, |
| 97 | + index.html, |
| 98 | + styles.css (excerpt), |
| 99 | + pubspec.yaml`) |
| 100 | + |
| 101 | +:marked |
| 102 | + These files are organized as follows: |
| 103 | + |
| 104 | +.filetree |
| 105 | + .file angular_quickstart |
| 106 | + .children |
| 107 | + .file lib |
| 108 | + .children |
| 109 | + .file app_component.dart |
| 110 | + .file web |
36 | 111 | .children
|
37 |
| - .file lib |
38 |
| - .children |
39 |
| - .file app_component.dart |
40 |
| - .file pubspec.yaml |
41 |
| - .file web |
42 |
| - .children |
43 |
| - .file index.html |
44 |
| - .file main.dart |
45 |
| - .file styles.css |
46 |
| - |
47 |
| -block install-tooling |
| 112 | + .file main.dart |
| 113 | + .file index.html |
| 114 | + .file styles.css |
| 115 | + .file pubspec.yaml |
| 116 | + |
| 117 | +:marked |
| 118 | + All guides and cookbooks have _at least these core files_. Each file has a distinct purpose and evolves independently as the application grows. |
| 119 | + |
| 120 | +style td, th {vertical-align: top} |
| 121 | +table(width="100%") |
| 122 | + col(width="20%") |
| 123 | + col(width="80%") |
| 124 | + tr |
| 125 | + th File |
| 126 | + th Purpose |
| 127 | + tr |
| 128 | + td <code>lib/app_component.dart</code> |
| 129 | + td |
| 130 | + :marked |
| 131 | + Defines `<my-app>`, the **root** component of what will become a tree of nested components |
| 132 | + as the application evolves. |
| 133 | + tr |
| 134 | + td <code>web/main.dart</code> |
| 135 | + td |
| 136 | + :marked |
| 137 | + Bootstraps the application to run in the browser. |
| 138 | + tr |
| 139 | + td <code>web/index.html</code> |
| 140 | + td |
| 141 | + :marked |
| 142 | + Contains the `<my-app>` tag in its `<body>`. |
| 143 | + This is where the app lives! |
| 144 | + tr |
| 145 | + td <code>web/styles.css</code> |
| 146 | + td |
| 147 | + :marked |
| 148 | + A set of styles used throughout the app. |
| 149 | + tr |
| 150 | + td <code>pubspec.yaml</code> |
| 151 | + td |
| 152 | + :marked |
| 153 | + The file that describes this Dart package (the app) and its dependencies. |
| 154 | + For example, it specifies the **angular2** and **browser** packages as dependencies, |
| 155 | + as well as the **angular2** transformer. |
| 156 | + |
| 157 | +.l-sub-section |
48 | 158 | :marked
|
49 |
| - Install the **[Dart SDK](https://www.dartlang.org/downloads/)**, |
50 |
| - if not already on your machine, and any tools you like to use with Dart. |
51 |
| - The Dart SDK includes tools such as **[pub][pub]**, the Dart package manager. |
52 |
| - If you don't have a favorite Dart editor already, try |
53 |
| - [WebStorm][WS], which comes with a Dart plugin. |
54 |
| - You can also download [Dart plugins for other IDEs and editors][DT]. |
55 |
| - |
56 |
| - [WS]: https://confluence.jetbrains.com/display/WI/Getting+started+with+Dart |
57 |
| - [DT]: https://www.dartlang.org/tools/ |
58 |
| - [pub]: https://www.dartlang.org/tools/pub/ |
| 159 | + ### Next step |
| 160 | + |
| 161 | + If you're new to Angular, we recommend staying on the [learning path](learning-angular.html). |
0 commit comments