@@ -72,13 +72,10 @@ the project folder is where you want it.
72
72
change the name of the project from ` untitled ` to ` pirate_badge ` .
73
73
</li >
74
74
75
- <li markdown =" 1 " >Make sure that **Start Dartium in checked mode** is checked.
76
- </li >
77
-
78
75
<li markdown =" 1 " >Make sure that **Generate sample content** is checked.
79
76
</li >
80
77
81
- <li markdown =" 1 " >Select **Angular 2 Web Application ** from the list.
78
+ <li markdown =" 1 " >Select **Angular QuickStart Example ** from the list.
82
79
83
80
The form should look similar to the following:
84
81
@@ -201,7 +198,7 @@ Get familiar with the structure of a basic Angular app.
201
198
In the ** Project** view, on the left, expand the ` pirate_badge ` folder.
202
199
Then expand the ` lib ` and ` web ` folders to see the following:
203
200
204
- <img style =" border :1px solid black " src =" images/project-files.jpg " alt =" The list of autocreated files. " >
201
+ <img style =" border :1px solid black " src =" images/project-files.png " alt =" The list of autocreated files. " >
205
202
</div >
206
203
207
204
</div > <div class =" col-md-5 " markdown =" 1 " >
@@ -232,7 +229,6 @@ this code lab:
232
229
pirate_badge/
233
230
lib/
234
231
app_component.dart
235
- app_component.html
236
232
web/
237
233
index.html
238
234
main.dart
@@ -243,7 +239,6 @@ As you might expect,
243
239
the ` lib ` directory contains library files. In an Angular app,
244
240
component classes are generally created as library files.
245
241
The ` web ` directory contains the main files for a web app.
246
- Double clicking a file opens that file in the editor view.
247
242
</div >
248
243
249
244
</div > <div class =" col-md-5 " markdown =" 1 " >
@@ -332,13 +327,13 @@ main() {
332
327
<! DOCTYPE html>
333
328
<html >
334
329
<head >
335
- <title>pirate_badge </title>
336
-
330
+ <title>Hello Angular </title>
331
+ ...
337
332
<script defer src="main.dart" type="application/dart"></script>
338
333
<script defer src="packages/browser/dart.js"></script>
339
334
</head >
340
335
<body >
341
- <my-app>Loading...</my-app>
336
+ <my-app>Loading AppComponent content here ...</my-app>
342
337
</body >
343
338
</html >
344
339
{% endprettify %}
@@ -375,8 +370,10 @@ main() {
375
370
{% prettify dart %}
376
371
import 'package: angular2 /core.dart';
377
372
378
- @Component (selector: 'my-app', templateUrl: 'app_component.html')
379
- class AppComponent {}
373
+ @Component (selector: 'my-app', template: '<h1 >Hello {% raw %}{{name}}{% endraw %}</h1 >')
374
+ class AppComponent {
375
+ var name = 'Angular';
376
+ }
380
377
{% endprettify %}
381
378
</div >
382
379
@@ -391,43 +388,25 @@ class AppComponent {}
391
388
component.
392
389
393
390
* The ` @Component ` constructor has two named parameters: ` selector `
394
- and ` templateUrl ` .
391
+ and ` template ` .
395
392
396
393
* The ` selector ` parameter specifies a CSS selector for this component.
397
394
Angular creates and displays an instance of ` AppComponent ` when it
398
395
encounters a ` <my-app> ` element in the HTML.
399
396
400
- * The ` templateUrl ` parameter specifies the file that contains the view.
401
- To define the HTML _ within_ the Dart file as a Dart string,
402
- use the ` template ` parameter instead.
403
-
404
-   ; {% comment %} non-breaking space required for bootstrap/markdown bogosity {% endcomment %}
405
- </div > </div >
406
-
407
- <hr >
408
-
409
- <div class =" trydart-step-details " markdown =" 1 " >
410
- ### ** app_component.html**
411
- </div >
412
-
413
- <div class =" row " > <div class =" col-md-7 " markdown =" 1 " >
414
- <div class =" trydart-step-details " markdown =" 1 " >
415
-
416
- {% prettify html %}
417
- <h1 >My First Angular 2 App</h1 >
418
- {% endprettify %}
419
-
420
- </div >
421
-
422
- </div > <div class =" col-md-5 " markdown =" 1 " >
423
-
424
- <i class =" fa fa-key key-header " > </i > <strong > Key information </strong >
397
+ * The ` template ` parameter specifies the HTML that's inserted
398
+ whenever a ` <my-app> ` element appears in the app.
399
+ This simple component displays a title.
425
400
426
- * This simple component displays a title.
401
+ * The double curly braces, ` {% raw %}{{{% endraw %} ` and ` {% raw %}}}{% endraw %} ` ,
402
+ indicate an Angular interpolation binding expression.
403
+ At runtime, Angular replaces ` {% raw %} ` {{name}}` {% endraw %} `
404
+ with the value of the component's ` name ` property.
427
405
428
- * This file is the template for the AppComponent class.
429
- This HTML is inserted whenever the ` <my-app> ` element
430
- appears in the app.
406
+ * For any nontrivial template,
407
+ use a ` templateUrl ` parameter instead of ` template ` ,
408
+ and put the template code in its own HTML file.
409
+ The next step shows how to use ` templateUrl ` .
431
410
432
411
  ; {% comment %} non-breaking space required for bootstrap/markdown bogosity {% endcomment %}
433
412
</div > </div >
@@ -443,12 +422,13 @@ class AppComponent {}
443
422
444
423
{% prettify yaml %}
445
424
name: pirate_badge
446
- description: A Dart app that uses Angular 2
425
+ description: QuickStart
447
426
version: 0.0.1
448
427
environment:
449
- sdk: '>=1.13 .0 <2.0.0'
428
+ sdk: '>=1.19 .0 <2.0.0'
450
429
dependencies:
451
- angular2: 2.0.0-beta.17
430
+ angular2: ^2.2.0
431
+ dev_dependencies:
452
432
browser: ^0.10.0
453
433
dart_to_js_script_rewriter: ^1.0.1
454
434
transformers:
@@ -481,7 +461,7 @@ transformers:
481
461
Transformers are listed and configured in
482
462
the pubspec under the ` transformers: ` field.
483
463
484
- * The Angular 2 transformer generates static structures that
464
+ * The ` angular2 ` transformer generates static structures that
485
465
remove the need for reflection at runtime, making your app
486
466
run more efficiently.
487
467
@@ -532,7 +512,7 @@ and click the Dartium icon on the far right.
532
512
WebStorm launches the app in a Dartium window.
533
513
You should see something like the following:
534
514
535
- <img style = " border : 1 px solid black " src =" images/first-ng2-app.png " alt =" The skeleton app. " >
515
+ <img src =" images/first-ng2-app.png " alt =" The skeleton app. " >
536
516
537
517
After you've run the app using the menu, WebStorm remembers.
538
518
In the future, you can launch the app using the enabled ** Run** button
@@ -633,7 +613,6 @@ check your code against the files in
633
613
[ 1-skeleton] ( https://github.com/dart-lang/one-hour-codelab/tree/master/ng2/1-skeleton ) .
634
614
635
615
* [ lib/app_component.dart] ( https://raw.githubusercontent.com/dart-lang/one-hour-codelab/master/ng2/1-skeleton/lib/app_component.dart )
636
- * [ lib/app_component.html] ( https://raw.githubusercontent.com/dart-lang/one-hour-codelab/master/ng2/1-skeleton/lib/app_component.html )
637
616
* [ web/main.dart] ( https://raw.githubusercontent.com/dart-lang/one-hour-codelab/master/ng2/1-skeleton/web/main.dart )
638
617
* [ web/index.html] ( https://raw.githubusercontent.com/dart-lang/one-hour-codelab/master/ng2/1-skeleton/web/index.html )
639
618
* [ pubspec.yaml] ( https://raw.githubusercontent.com/dart-lang/one-hour-codelab/master/ng2/1-skeleton/pubspec.yaml )
0 commit comments