@@ -7,22 +7,22 @@ block includes
7
7
- var _angular_browser_uri = ' package:angular2/platform/browser.dart'
8
8
- var _angular_core_uri = ' package:angular2/core.dart'
9
9
- var _appDir = ' lib'
10
+ - var _anAppDir = ' a lib'
10
11
- var _indexHtmlDir = ' web'
11
12
12
13
block setup-tooling
13
14
:marked
14
15
Install the **[Dart SDK](https://www.dartlang.org/downloads/)**,
15
16
if not already on your machine, and any tools you like to use with Dart.
16
- The Dart SDK includes **[pub][pub]**, the Dart package manager, that we
17
- will be using shortly.
17
+ The Dart SDK includes tools such as **[pub][pub]**, the Dart package manager.
18
18
If you don't have a favorite Dart editor already, try
19
19
[WebStorm][WS], which comes with a Dart plugin.
20
20
You can also download [Dart plugins for other IDEs and editors][DT].
21
21
22
22
[WS]: https://confluence.jetbrains.com/display/WI/Getting+started+with+Dart
23
23
[DT]: https://www.dartlang.org/tools
24
24
[pub]: https://www.dartlang.org/tools/pub
25
-
25
+
26
26
block download-source
27
27
// exclude this section from Dart
28
28
@@ -57,8 +57,8 @@ block create-main
57
57
Now we need something to tell Angular to load the root component.
58
58
Create:
59
59
ul
60
- li a #[ b folder named #[ code web] ] , and inside it
61
- li the file #[ code #[ + adjExPath('app/main.ts' )] ] with the following content:
60
+ li a #[ b folder named #[ code web] ]
61
+ li a file named #[ code #[ + adjExPath('app/main.ts' )] ] with the following content:
62
62
63
63
block index-html-commentary-for-ts
64
64
//- N/A
@@ -76,7 +76,7 @@ block run-app
76
76
and then run it by visiting <b ><code >http://localhost:8080</code ></b > in any modern browser.
77
77
Pub serve generates JavaScript on the fly,
78
78
which can take a while when you first visit the page.
79
- Pub serve also runs in <b ><i >watch mode</i ></b >, and will re-compile and subsequently serve
79
+ Pub serve also runs in <b ><i >watch mode</i ></b >, and will recompile and subsequently serve
80
80
and changed assets.
81
81
p.
82
82
Once the app is running, you should see the following in your browser
@@ -85,7 +85,7 @@ block run-app
85
85
block build-app
86
86
.alert.is-important
87
87
:marked
88
- If you don't see that , make sure you've entered all the code correctly,
88
+ If you don't see **My First Angular 2 App** , make sure you've entered all the code correctly,
89
89
in the [proper folders](#wrap-up),
90
90
and run `pub get`.
91
91
@@ -105,6 +105,11 @@ block build-app
105
105
- var stylePattern = { pnk: / (dart_to_js_script_rewriter. * $ )| (- dart_to_js_script_rewriter. * $ )/ gm , otl: / (dependencies:)| (transformers:)/ g };
106
106
+ makeExample('quickstart/dart/pubspec.yaml' , null , 'pubspec.yaml' , stylePattern)
107
107
108
+ .alert.is-important
109
+ :marked
110
+ The `dart_to_js_script_rewriter` transformer must be
111
+ **after** the `angular2` transformer in `pubspec.yaml`.
112
+
108
113
p.
109
114
Then compile your Dart code to JavaScript,
110
115
using <code >pub build</code >.
@@ -115,7 +120,7 @@ block build-app
115
120
116
121
p.
117
122
The generated JavaScript appears, along with supporting files,
118
- under the <code >build</code > directory .
123
+ under a directory named <code >build</code >.
119
124
p.
120
125
When you generate JavaScript for an Angular app,
121
126
be sure to use the Angular transformer.
@@ -148,30 +153,39 @@ block build-app
148
153
(<code >entry_points</code > in <code >pubspec.yaml</code >)
149
154
so that they don't use mirrors.
150
155
151
- block server-watching
156
+ block server-watching
152
157
:marked
153
- Pub serve is watching and
154
- should detect the change, recompile the Dart into JavaScript,
155
- refresh the browser, and display the revised message.
156
- It's a nifty way to develop an application!
158
+ To see the new version, just reload the page.
157
159
158
- Ensure that you terminate the `pub serve` process once you are done.
160
+ .alert.is-important
161
+ :marked
162
+ Be sure to terminate the `pub serve` process once you stop working on this app.
159
163
160
164
block project-file-structure
161
165
.filetree
162
166
.file angular2-quickstart
163
167
.children
164
- .file build ...
165
168
.file lib
166
169
.children
167
170
.file app_component.dart
168
171
.file pubspec.yaml
169
172
.file web
170
173
.children
171
174
.file index.html
172
- .file main.ts
175
+ .file main.dart
173
176
.file styles.css
174
177
178
+ .l-verbose-section
179
+ :marked
180
+ This figure doesn't show generated files and directories.
181
+ For example, a `pubspec.lock` file
182
+ specifies versions and other identifying information for
183
+ the packages that our app depends on.
184
+ The `pub build` command creates a `build` directory
185
+ containing the JavaScript version of our app.
186
+ Pub, IDEs, and other tools might create
187
+ other directories and dotfiles.
188
+
175
189
block project-files
176
190
+ makeTabs(`
177
191
quickstart/ts/app/app.component.ts,
@@ -180,10 +194,10 @@ block project-files
180
194
quickstart/dart/pubspec.yaml,
181
195
quickstart/ts/styles.1.css`
182
196
,null ,
183
- ` app/app.component.ts,
184
- app/main.ts,
197
+ ` app/app.component.ts,
198
+ app/main.ts,
185
199
index.html,
186
- pubspec.yaml,
200
+ pubspec.yaml,
187
201
styles.css` )
188
202
189
203
block what-next-ts-overhead
0 commit comments