@@ -41,8 +41,11 @@ block install-packages
41
41
packages (along with the packages they depend on).
42
42
43
43
code-example( language ="sh" class ="code-shell" ) .
44
- > <span class =" blk" >pub get</span >
45
- Resolving dependencies...
44
+ pub get
45
+
46
+ block create-your-app
47
+ :marked
48
+ Let's create a folder to hold our application and add a super-simple Angular component.
46
49
47
50
block annotation-fields
48
51
:marked
@@ -57,6 +60,10 @@ block create-main
57
60
li a #[ b folder named #[ code web] ]
58
61
li a <b >file named #[code #[+adjExPath('app/main.ts')]]</b > with the following content:
59
62
63
+ block commentary-on-index-html
64
+ :marked
65
+ Note the `<my-app>` tag in the `<body>`, this is *where your app lives!*
66
+
60
67
block run-app
61
68
p.
62
69
We have a few options for running our app.
@@ -76,91 +83,93 @@ block run-app
76
83
Once the app is running, the browser window should show the following:
77
84
78
85
block build-app
79
- .alert.is-important
80
- :marked
81
- If you don't see **My First Angular App**, make sure you've entered all the code correctly,
82
- in the [proper folders](#wrap-up),
83
- and run `pub get`.
86
+ //- Remove details of building from QS for now. (It is too early for these details.)
87
+ if false
88
+ .alert.is-important
89
+ :marked
90
+ If you don't see **Hello Angular!**, make sure you've entered all the code correctly,
91
+ in the [proper folders](#wrap-up),
92
+ and run `pub get`.
84
93
85
- .l-verbose-section #section-angular-run-app
86
- :marked
87
- ### Building the app (generating JavaScript)
94
+ .l-verbose-section #section-angular-run-app
95
+ :marked
96
+ ### Building the app (generating JavaScript)
88
97
89
- Before deploying the app, we need to generate JavaScript files.
90
- The `pub build` command makes that easy.
98
+ Before deploying the app, we need to generate JavaScript files.
99
+ The `pub build` command makes that easy.
91
100
92
- code-example( language ="sh" class ="code-shell" ) .
93
- > <span class =" blk" >pub build</span >
94
- Loading source assets...
101
+ code-example( language ="sh" class ="code-shell" ) .
102
+ > <span class =" blk" >pub build</span >
103
+ Loading source assets...
104
+
105
+ :marked
106
+ The generated JavaScript appears, along with supporting files,
107
+ under a directory named `build`.
108
+
109
+ #angular_transformer
110
+ h4 Using the Angular transformer
95
111
96
- :marked
97
- The generated JavaScript appears, along with supporting files,
98
- under a directory named `build`.
99
-
100
- #angular_transformer
101
- h4 Using the Angular transformer
102
-
103
- p.
104
- When generating JavaScript for an Angular app,
105
- be sure to use the Angular transformer.
106
- It analyzes the Dart code,
107
- converting reflection-using code to static code
108
- that Dart's build tools can compile to faster, smaller JavaScript.
109
- The highlighted lines in <code >pubspec.yaml</code >
110
- configure the Angular transformer:
111
-
112
- - var stylePattern = { otl: / (transformers:)| (- angular2:)| (entry_points. * $ )/ gm };
113
- + makeExample('quickstart/dart/pubspec.yaml' , null , 'pubspec.yaml' , stylePattern)
114
-
115
- p.
116
- The <code >entry_points</code > item
117
- identifies the Dart file in our app
118
- that has a <code >main()</code > function.
119
- For more information, see the
120
- <a href =" https://github.com/angular/angular/wiki/Angular-2-Dart-Transformer" >Angular
121
- transformer wiki page</a >.
122
-
123
- .l-sub-section #performance
124
- h3 Performance, the transformer, and Angular libraries
125
112
p.
126
- When an app imports <code >bootstrap.dart</code >,
127
- it also gets <code >dart:mirrors</code >,
128
- a reflection library that
129
- causes performance problems when compiled to JavaScript.
130
- Don't worry,
131
- the Angular transformer converts the app's entry points
132
- (<code >entry_points</code > in <code >pubspec.yaml</code >)
133
- so that they don't use mirrors.
134
-
135
- #dart_to_js_script_rewriter
136
- h4 Using dart_to_js_script_rewriter
113
+ When generating JavaScript for an Angular app,
114
+ be sure to use the Angular transformer.
115
+ It analyzes the Dart code,
116
+ converting reflection-using code to static code
117
+ that Dart's build tools can compile to faster, smaller JavaScript.
118
+ The highlighted lines in <code >pubspec.yaml</code >
119
+ configure the Angular transformer:
137
120
138
- :marked
139
- To improve the app's performance, convert the
140
- HTML file to directly include the generated JavaScript;
141
- one way to do that is with `dart_to_js_script_rewriter`.
142
- To use the rewriter, specify `dart_to_js_script_rewriter` in both
143
- the `dependencies` and `transformers` sections of the pubspec.
121
+ - var stylePattern = { otl: / (transformers:)| (- angular2:)| (entry_points. * $ )/ gm };
122
+ + makeExample('quickstart/dart/pubspec.yaml' , null , 'pubspec.yaml' , stylePattern)
144
123
145
- - var stylePattern = { otl: / (dart_to_js_script_rewriter. * $ )| (- dart_to_js_script_rewriter. * $ )| (dependencies:)| (transformers:)/ gm };
146
- + makeExample('quickstart/dart/pubspec.yaml' , null , 'pubspec.yaml' , stylePattern)
124
+ p.
125
+ The <code >entry_points</code > item
126
+ identifies the Dart file in our app
127
+ that has a <code >main()</code > function.
128
+ For more information, see the
129
+ <a href =" https://github.com/angular/angular/wiki/Angular-2-Dart-Transformer" >Angular
130
+ transformer wiki page</a >.
131
+
132
+ .l-sub-section #performance
133
+ h3 Performance, the transformer, and Angular libraries
134
+ p.
135
+ When an app imports <code >bootstrap.dart</code >,
136
+ it also gets <code >dart:mirrors</code >,
137
+ a reflection library that
138
+ causes performance problems when compiled to JavaScript.
139
+ Don't worry,
140
+ the Angular transformer converts the app's entry points
141
+ (<code >entry_points</code > in <code >pubspec.yaml</code >)
142
+ so that they don't use mirrors.
143
+
144
+ #dart_to_js_script_rewriter
145
+ h4 Using dart_to_js_script_rewriter
147
146
148
- .alert.is-important
149
147
:marked
150
- The `dart_to_js_script_rewriter` transformer must be
151
- **after** the `angular2` transformer in `pubspec.yaml`.
148
+ To improve the app's performance, convert the
149
+ HTML file to directly include the generated JavaScript;
150
+ one way to do that is with `dart_to_js_script_rewriter`.
151
+ To use the rewriter, specify `dart_to_js_script_rewriter` in both
152
+ the `dependencies` and `transformers` sections of the pubspec.
152
153
153
- :marked
154
- For more information, see the docs for
155
- [dart_to_js_script_rewriter](https://pub.dartlang.org/packages/dart_to_js_script_rewriter).
154
+ - var stylePattern = { otl: / (dart_to_js_script_rewriter. * $ )| (- dart_to_js_script_rewriter. * $ )| (dependencies:)| (transformers:)/ gm };
155
+ + makeExample('quickstart/dart/pubspec.yaml' , null , 'pubspec.yaml' , stylePattern)
156
+
157
+ .alert.is-important
158
+ :marked
159
+ The `dart_to_js_script_rewriter` transformer must be
160
+ **after** the `angular2` transformer in `pubspec.yaml`.
161
+
162
+ :marked
163
+ For more information, see the docs for
164
+ [dart_to_js_script_rewriter](https://pub.dartlang.org/packages/dart_to_js_script_rewriter).
156
165
157
166
block server-watching
158
167
:marked
159
168
To see the new version, just reload the page.
160
169
161
170
.alert.is-important
162
171
:marked
163
- Be sure to terminate the `pub serve` process once you stop working on this app.
172
+ Be sure to terminate your local server once you stop working on this app.
164
173
165
174
block project-file-structure
166
175
.filetree
0 commit comments