From f293d61875494cea48ba6d10e17ece180a2f72de Mon Sep 17 00:00:00 2001 From: Kathy Walrath Date: Wed, 30 Sep 2015 17:19:11 -0700 Subject: [PATCH] clarify/improve imports & import discussion --- .../dart/latest/guide/displaying-data.jade | 28 +++++++++++++------ public/docs/dart/latest/guide/user-input.jade | 1 - 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/public/docs/dart/latest/guide/displaying-data.jade b/public/docs/dart/latest/guide/displaying-data.jade index 0153ce90f3..6426232e14 100644 --- a/public/docs/dart/latest/guide/displaying-data.jade +++ b/public/docs/dart/latest/guide/displaying-data.jade @@ -18,7 +18,6 @@ code-tabs code-pane(language="dart" name="web/main.dart" format="linenums"). - import 'package:angular2/angular2.dart'; import 'package:angular2/bootstrap.dart'; import 'package:displaying_data/show_properties.dart'; @@ -50,9 +49,14 @@ entry_points: web/main.dart p. All of this code should look familiar from the previous page, - except for the import of show_properties.dart - in main.dart. - That import statement lets you implement part of the app in a different Dart file. + except for the imports in main.dart. + The import of show_properties.dart + lets you implement part of the app in a different Dart file. + You've previously seen angular2.dart imported, + but that's unnecessary here because this version of main.dart + doesn't implement any components or other injectable types. + + p. All three of these files remain similar in the rest of the examples, so we'll focus on what changes. @@ -325,7 +329,6 @@ List<String> names = ['Aarav', 'Martín', 'Shannon', 'Ariana', 'Kai']; } code-pane(language="dart" name="web/main.dart" format="linenums"). - import 'package:angular2/angular2.dart'; import 'package:angular2/bootstrap.dart'; import 'package:displaying_data/show_properties.dart'; @@ -430,26 +433,33 @@ p. The app's entry point—main.dart—imports - angular2.dart and bootstrap.dart. + bootstrap.dart so that it can call bootstrap(). Both show_properties.dart and friends_service.dart - import only angular2.dart - because they aren't entry points. + import angular2.dart + so that they can define Angular components and models. code-example(language="dart"). // In web/main.dart: - import 'package:angular2/angular2.dart'; import 'package:angular2/bootstrap.dart'; ... + bootstrap(...) + ... // In lib/show_properties.dart: ... import 'package:angular2/angular2.dart'; ... + @Component(...) + @View(...) + ... // In lib/friends_service.dart: ... import 'package:angular2/angular2.dart'; ... + @Injectable() + ... + p. For more information on implementing Dart libraries, see diff --git a/public/docs/dart/latest/guide/user-input.jade b/public/docs/dart/latest/guide/user-input.jade index 35d6741380..3d13469c3c 100644 --- a/public/docs/dart/latest/guide/user-input.jade +++ b/public/docs/dart/latest/guide/user-input.jade @@ -167,7 +167,6 @@ } } code-pane(language="dart" name="web/main.dart" format="linenums"). - import 'package:angular2/angular2.dart'; import 'package:angular2/bootstrap.dart'; import 'package:user_input/todo_list.dart';